コード例 #1
0
 public IActionResult ChangeCar(RentChangeCarViewModel model)
 {
     if (ModelState.IsValid)
     {
         Rent rent = _rentsRepository.GetRent(model.Id);
         rent.CarId = model.CarId;
         return(RedirectToAction("handoverstart", new { id = model.Id }));
     }
     return(RedirectToAction("ChangeCar", new { id = model.Id }));
 }
コード例 #2
0
        public ViewResult ChangeCar(Guid id)
        {
            Rent       r1   = _rentsRepository.GetRent(id);
            List <Car> cars = _carsRepository.GetFreeCars().ToList();

            cars.Add(_carsRepository.GetCar(r1.CarId));
            RentChangeCarViewModel model = new RentChangeCarViewModel
            {
                CarId = r1.CarId,
                Cars  = cars,
                Id    = id
            };

            return(View(model));
        }