コード例 #1
0
        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 BookingViewModel
            {
                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(CreateUpdateBookingCommand(booking));

            if (result.IsSuccesfull)
            {
                return(new RedirectToPageResult("ReservedBookings"));
            }

            return(new RedirectToPageResult("Error"));
        }
コード例 #2
0
        public async Task <IActionResult> OnPostDelete(string id)
        {
            var guid = Guid.Parse(id);

            var result = await BookingDataService.DeleteBooking(guid);

            return(new RedirectToPageResult("ReservedBookings"));
        }
コード例 #3
0
        public async Task <IActionResult> OnGetAsync(string id)
        {
            var guid = Guid.Parse(id);

            Booking = await BookingDataService.GetBookingById(guid);

            ArrivalHour   = Booking.ActualArrival.Hour;
            ArrivalMinute = Booking.ActualArrival.Minute;

            startHour   = Booking.StartLoading.Hour;
            startMinute = Booking.StartLoading.Minute;

            endHour   = Booking.EndLoading.Hour;
            endMinute = Booking.EndLoading.Minute;

            return(Page());
        }
コード例 #4
0
        public async Task <IActionResult> OnGetAsync()
        {
            BookingsListViewModel = await BookingDataService.GetBookings();


            var loggedIn = await TransporterDataService.GetTransporterById(_userUtility.GetCurrentUserId());

            var allBookings = await BookingDataService.GetBookings();

            var intervalViewModels = new List <IntervalViewModel>();

            foreach (var booking in allBookings.Bookings)
            {
                if (booking.TransporterId == loggedIn.TransporterId)
                {
                    BookingsListViewModel.Bookings.Add(booking);
                    intervalViewModels.Add(booking.Interval);
                }
            }

            IntervalViewModels = intervalViewModels.DistinctBy(x => x.IntervalId).ToList();
            return(Page());
        }