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 })); }
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)); }