//--------------RETURN CAR--------------// public ActionResult Return(RentViewModel rentVM) { Rent rent = rentServices.GetByID(rentVM.RentID); rentVM = Mapper.Map<Rent, RentViewModel>(rent); rentVM.ReturnDate = DateTime.Now.ToString("dd/mm/yyyy"); if ((DateTime.Now - rent.PickupDate).Days != 0) { rentVM.Price = (DateTime.Now - rent.PickupDate).Days * rent.Car.Price; } else { rentVM.Price = rent.Car.Price; } return View(rentVM); }
public ActionResult ReturnConfirmed(RentViewModel rentVM) { Rent rent = rentServices.GetByID(rentVM.RentID); rent.ReturnDate = DateTime.Now; if ((DateTime.Now - rent.PickupDate).Days != 0) { rent.Price = (DateTime.Now - rent.PickupDate).Days * rent.Car.Price; } else { rent.Price = rent.Car.Price; } rentServices.Update(rent); rentServices.Save(); return RedirectToAction("Index"); }
public ActionResult ReviewRentConfirmed(RentViewModel rentVM) { rentServices.Add(Mapper.Map<RentViewModel, Rent>(rentVM)); rentServices.Save(); return RedirectToAction("Index"); }
//--------------REVIEW RENT--------------// public ActionResult ReviewRent(RentViewModel rentVM) { return View(rentVM); }
public ActionResult SelectClient(RentViewModel rentVM) { return RedirectToAction("SearchCar", rentVM); }
public ActionResult SelectCar(RentViewModel rentVM) { return RedirectToAction("ReviewRent", rentVM); }
public ActionResult SearchClient(RentViewModel rentVM) { List<Client> UserList = rentServices.GetClients(rentVM.searchString); rentVM.UserList = new List<ClientViewModel>(); foreach (Client user in UserList) { rentVM.UserList.Add(Mapper.Map<Client, ClientViewModel>(user)); } return View(rentVM); }
public ActionResult SearchCarConfirmed(RentViewModel rentVM) { List<Car> CarList = rentServices.GetCars(rentVM.searchString); rentVM.CarList = new List<ListDetailsDeleteCarViewModel>(); foreach (Car car in CarList) { rentVM.CarList.Add(Mapper.Map<Car, ListDetailsDeleteCarViewModel>(car)); } return View(rentVM); }
//--------------SEARCH CAR--------------// public ActionResult SearchCar(RentViewModel rentVM) { return View(Mapper.Map<Rent, RentViewModel>(new Rent())); }