public async Task <IActionResult> AddBookingSession(ScheduleViewModel schedule)
        {
            if (ModelState.IsValid)
            {
                // Hard coding tenantId for sake of testing...
                var addBookingSession = new AddBookingSessionDto
                {
                    StartTime     = schedule.StartTime,
                    EndTime       = schedule.EndTime,
                    TenantId      = 2,
                    LaundryRoomId = 23
                };

                var success = await _bookingSessionService.AddBookingSession(addBookingSession);

                if (success)
                {
                    TempData["ReservationSuccess"] = NotificationMessage.ReservationSuccess;

                    return(RedirectToAction("Schedule",
                                            ReturnBasicParameters(schedule.LaundryRoomId, schedule.WeekNumber)));
                }
            }

            TempData["ReservationError"] = NotificationMessage.ReservationError;

            return(RedirectToAction("Schedule",
                                    ReturnBasicParameters(schedule.LaundryRoomId, schedule.WeekNumber)));
        }
Beispiel #2
0
        public async Task <bool> AddBookingSession(AddBookingSessionDto bookingSessionDto)
        {
            var bookingSession = _mapper.Map <AddBookingSessionModel>(bookingSessionDto);

            bookingSession.SessionStatus = "Scheduled";

            var success = await _bookingSessionRepository.AddBookingSession(bookingSession);

            return(success);
        }