Yashogi
Yashogi
CC#
Created by Yashogi on 3/20/2023 in #help
❔ Object reference set to null
var showTime = ShowTimes.Where(x => x.ShowTimeID == request.ShowTimeId).FirstOrDefault();

int totalTicketsRequested = request.RequireTickets.Count();

if (showTime.Theatre.SeatingSize < totalTicketsRequested)
{
throw new Exception("There are not enough seats available for this purchase");
}
var showTime = ShowTimes.Where(x => x.ShowTimeID == request.ShowTimeId).FirstOrDefault();

int totalTicketsRequested = request.RequireTickets.Count();

if (showTime.Theatre.SeatingSize < totalTicketsRequested)
{
throw new Exception("There are not enough seats available for this purchase");
}
With the code shown I am trying to grab the showtimeID the user selected and use it to figure out the seating size of the theatre to ensure the total tickets selected by the user don't exceed the seating size
7 replies
CC#
Created by Yashogi on 2/6/2023 in #help
LInq Combine duplicates
222 replies
CC#
Created by Yashogi on 11/21/2022 in #help
❔ Query won't filter
3 replies
CC#
Created by Yashogi on 10/6/2022 in #help
Compare Year and Datetime year
I need my year to be less than or equal to current year.
DateTime dt = new DateTime(2022, 10, 06);
DateTime dt = new DateTime(2022, 10, 06);
this is the way I set up my Date Time
public readonly int Year;
public readonly int Year;
is what I have in my class and I throw this exception but get an error
if (year <= dt) {
throw new ArgumentOutOfRangeException("The Year must be greater than or equal to the current date and time.");
}
if (year <= dt) {
throw new ArgumentOutOfRangeException("The Year must be greater than or equal to the current date and time.");
}
29 replies
CC#
Created by Yashogi on 9/27/2022 in #help
Trying to add GrossWeight each time it shows up in the list
47 replies