public ActionResult Edit(Reservation reservation, int Id)
        {
            Reservation      reservationToEdit = context.Find(Id);
            RentalsViewModel viewModel         = RentalsViewModel.FromReservation(reservation);

            if (reservationToEdit == null)
            {
                return(HttpNotFound());
            }
            else
            {
                if (!ModelState.IsValid)
                {
                    return(View(viewModel));
                }

                reservationToEdit.CarID         = reservation.CarID;
                reservationToEdit.CostumerID    = reservation.CostumerID;
                reservationToEdit.StartDate     = reservation.StartDate;
                reservationToEdit.ReservStatsID = reservation.ReservStatsID;
                reservationToEdit.EndDate       = reservation.EndDate;
                reservationToEdit.LocationID    = reservation.LocationID;

                context.Commit();

                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Create()
        {
            Reservation      reservation = new Reservation();
            RentalsViewModel viewModel   = RentalsViewModel.FromReservation(reservation);

            viewModel.Locations = viewModel.GetLocations();
            viewModel.Cars      = viewModel.GetCars();
            return(View(viewModel));
        }
        public ActionResult Edit(int Id)
        {
            Reservation      reservation = context.Find(Id);
            RentalsViewModel viewModel   = RentalsViewModel.FromReservation(reservation);

            viewModel.Locations = viewModel.GetLocations();
            viewModel.Cars      = viewModel.GetCars();

            if (reservation == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(viewModel));
            }
        }