Created
February 17, 2022 13:18
-
-
Save ceddlyburge/019b84c0abc8f244525c4da579b676c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int? Accept(Reservation reservation) | |
{ | |
if (!IsReservationInFuture(reservation)) | |
return null; | |
try { | |
var reservedSeats = | |
ReadReservations(reservation.Date) | |
.Sum(r => r.Quantity); | |
if (Capacity < reservedSeats + reservation.Quantity) | |
return null; | |
} except { | |
return null | |
} | |
reservation.IsAccepted = true; | |
return Create(reservation); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Part of We should format code on demand blog post
Currently our source code is saved to disk already formatted, and our editors display this saved format. There are many auto formatting tools, but the results always get saved back to disk. What happens if we save to a standardised text representation, and instead format code on demand, in the editor?