public IActionResult Edit(RentEditViewModel model) { if (ModelState.IsValid) { Rent rent = _rentsRepository.GetRent(model.Id); rent.AssistanceIncluded = model.AssistanceIncluded; rent.DamageFee = model.DamageFee; rent.EndDate = model.EndDate; rent.InitialPayment = model.InitialPayment; rent.IsEndDateSet = model.IsEndDateSet; rent.MilageLimit = model.MilageLimit; rent.OverMilageFee = model.OverMilageFee; rent.StartDate = model.ProposedStartDate; rent.RentFee = model.RentFee; rent.RentingCompany = model.RentingCompany; rent.RentType = model.RentType; rent.ReplacementCarIncluded = model.ReplacementCarIncluded; rent.ServiceIncluded = model.ServiceIncluded; rent.TyresIncluded = model.TyresIncluded; rent.UserMail = model.UserMail; rent.UserName = model.UserName; rent.UserPhone = model.UserPhone; _rentsRepository.Update(rent); return(RedirectToAction("details", new { id = model.Id })); } return(RedirectToAction("edit", new { id = model.Id })); }
public ViewResult Edit(Guid id) { Rent rent = _rentsRepository.GetRent(id); Client client = _clientsRepository.GetClient(rent.ClientId); Car car = _carsRepository.GetCar(rent.CarId); RentEditViewModel model = new RentEditViewModel { Id = rent.Id, Car = car, Client = client, AssistanceIncluded = rent.AssistanceIncluded, DamageFee = rent.DamageFee, EndDate = rent.EndDate, InitialPayment = rent.InitialPayment, IsEndDateSet = rent.IsEndDateSet, MilageLimit = rent.MilageLimit, OverMilageFee = rent.OverMilageFee, ProposedStartDate = rent.StartDate, RentFee = rent.RentFee, RentingCompany = rent.RentingCompany, RentType = rent.RentType, ReplacementCarIncluded = rent.ReplacementCarIncluded, ServiceIncluded = rent.ServiceIncluded, TyresIncluded = rent.TyresIncluded, UserMail = rent.UserMail, UserName = rent.UserName, UserPhone = rent.UserPhone }; return(View(model)); }