public ActionResult Modify(ReservationDetailsViewModel model) { if (!(model.AvailabilityDateFrom < model.DateTo && model.DateTo <= model.AvailabilityDateTo && model.DateFrom < model.AvailabilityDateTo && model.DateFrom >= model.AvailabilityDateFrom)) { ModelState.AddModelError("", "Reservation is not in availability range"); } if (ModelState.IsValid) { model.UserId = User.Identity.GetUserId(); var dbModel = Mapper.Map <ReservationDetailsViewModel, ReservationModel>(model); var isAdded = _reservationBusiness.Add(dbModel); if (!isAdded) { ModelState.AddModelError("", "Reservation exists."); return(View("Modify", model)); } return(RedirectToAction("Index", "Reservation", new { area = "UserPanel" })); //return RedirectToAction("Index", "ReservationEquipment", new { area = "UserPanel" }); } return(View("Modify", model)); }
public List <Reservation> Insert(Reservation reservation, List <Room> rooms) { _reservationBusiness.Add(reservation, rooms); return(_reservationBusiness.GetList()); }