public async Task <IActionResult> OnPostUpdate(List <DateTime> dateTo, List <TimeSpan> actualArrival, List <TimeSpan> startLoading, List <TimeSpan> endLoading, List <string> id) { var counter = 0; foreach (var GuidID in id) { var bookingToUpdate = await bookingDataService.GetBookingById(Guid.Parse(GuidID)); bookingToUpdate.ActualArrival = new DateTime(dateTo[counter].Year, dateTo[counter].Month, dateTo[counter].Day, actualArrival[counter].Hours, actualArrival[counter].Minutes, 0); bookingToUpdate.StartLoading = new DateTime(dateTo[counter].Year, dateTo[counter].Month, dateTo[counter].Day, startLoading[counter].Hours, startLoading[counter].Minutes, 0); bookingToUpdate.EndLoading = new DateTime(dateTo[counter].Year, dateTo[counter].Month, dateTo[counter].Day, endLoading[counter].Hours, endLoading[counter].Minutes, 0); var response = await bookingDataService.UpdateBooking(CreateUpdateBookingCommand(bookingToUpdate)); counter++; } return(new RedirectToPageResult("BookingOverview")); }
public async Task <IActionResult> OnPostUpdate(DateTime ViewBookTime, int ViewPallets, int ViewPort, int ActualArrivalHour, int ActualArrivalMinute, int startHour, int startMinute, int endHour, int endMinute, Guid ViewBookingId) { var booking = new UpdateBookingCommand() { BookingTime = ViewBookTime, TotalPallets = ViewPallets, Port = ViewPort, ActualArrival = GeneralUtil.TimeFromHourAndMinute(ActualArrivalHour, ActualArrivalMinute), StartLoading = GeneralUtil.TimeFromHourAndMinute(startHour, startMinute), EndLoading = GeneralUtil.TimeFromHourAndMinute(endHour, endMinute), InternalId = ViewBookingId }; var result = await bookingDataService.UpdateBooking(booking); if (result.IsSuccesfull) { Message = "Bookingen er opdateret korrekt"; return(new RedirectToPageResult("BookingSingle", new { id = ViewBookingId })); } return(new RedirectToPageResult("Error")); }