public async Task <AvailableSeatsSummary> GetCountAsync(IProjectionIdentifier projIdentifier) { var currProjection = await projectionsRepo.GetProjectionByIdAsync(projIdentifier.ProjectionId); var availableSeatsCount = currProjection.AvailableSeatsCount; return(new AvailableSeatsSummary(true, availableSeatsCount)); }
public async Task <AvailableSeatsSummary> GetCountAsync(IProjectionIdentifier projIdentifier) { var currProjection = await projectionsRepo.GetProjectionByIdAsync(projIdentifier.ProjectionId); if (currProjection == null) { string constraintMessage = $"Projection with Id: {projIdentifier.ProjectionId}, not exist!"; return(new AvailableSeatsSummary(false, constraintMessage)); } else { return(await availableSeats.GetCountAsync(projIdentifier)); } }
public async Task <AvailableSeatsSummary> GetCountAsync(IProjectionIdentifier projIdentifier) { var currProjection = await projectionsRepo.GetProjectionByIdAsync(projIdentifier.ProjectionId); if (currProjection.StartDate <= DateTime.Now) { var constraintMessage = "You are checking for seats too late for this projection! Seats are no longer available."; return(new AvailableSeatsSummary(false, constraintMessage)); } else { return(await availableSeats.GetCountAsync(projIdentifier)); } }