// // GET: /Reservation/ public ActionResult Index() { var viewReserv = new ReservationDTO { ReservationList = repository.GetAllReservations(), }; return View(viewReserv); }
public ActionResult Create(ReservationDTO reservationDTO) { var reserv = repository.CreateReservation(reservationDTO); if (ModelState.IsValid) { db.Reservations.Add(reserv); db.SaveChanges(); return RedirectToAction("Index"); } return View(reserv); }
// // GET: /Reservation/Details/5 public ActionResult Details(int id) { var reservation = repository.GetReservation(id); var reservView = new ReservationDTO { TotalPrice = reservation.TotalPrice, NumberOfPeople = reservation.NumberOfPeople, }; if (reservView == null) { return HttpNotFound(); } return View(reservView); }
public Models.Reservation UpdateReservation(ReservationDTO reservDTO) { var reserv = new Reservation { TotalPrice = reservDTO.TotalPrice, NumberOfPeople = reservDTO.NumberOfPeople, }; return reserv; }
public Models.Reservation CreateReservation(ReservationDTO reservationDTO) { var reservObject = new Reservation { TotalPrice = reservationDTO.TotalPrice, NumberOfPeople = reservationDTO.NumberOfPeople, }; return reservObject; }
public ActionResult Edit(ReservationDTO reservationDTO) { var editReserv = repository.UpdateReservation(reservationDTO); if (ModelState.IsValid) { db.Entry(editReserv).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(editReserv); }