public ActionResult MakeReservationAdmin(MakeReservationAdminVM makeReservationAdminVM) { var isValid = true; if (makeReservationAdminVM.AccomodationDate < DateTime.Today) { ModelState.AddModelError("AccomodationDate", "Accomodation date cannot be set before today"); isValid = false; } if (makeReservationAdminVM.AccomodationDate > makeReservationAdminVM.CheckOutDate) { ModelState.AddModelError("CheckOutDate", "Check out date cannot be set before accomodation"); isValid = false; } if (makeReservationAdminVM.AccomodationDate == makeReservationAdminVM.CheckOutDate) { ModelState.AddModelError("CheckOutDate", "Dates cannot be the same"); isValid = false; } if (!reservationService.CanMakeReservation(makeReservationAdminVM.RoomId, makeReservationAdminVM.AccomodationDate, makeReservationAdminVM.CheckOutDate)) { ModelState.AddModelError("AccomodationDate", "Another reservation is coliding with given dates"); isValid = false; } if (ModelState.IsValid && isValid) { var user = (User)Session["CurrentUser"]; this.reservationService.AddReservation(makeReservationAdminVM.RoomId, user.Identity, makeReservationAdminVM.AccomodationDate, makeReservationAdminVM.CheckOutDate, ReservationStatusEnum.Confirmed, makeReservationAdminVM.HotelBookingSite); TempData["message"] = "Successfully sent reservation"; return(RedirectToAction("RoomReservation", new { roomId = makeReservationAdminVM.RoomId })); } return(View(makeReservationAdminVM)); }