Exemplo n.º 1
0
        //--------------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);
        }
Exemplo n.º 2
0
 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");
 }
Exemplo n.º 3
0
 public ActionResult ReviewRentConfirmed(RentViewModel rentVM)
 {
     rentServices.Add(Mapper.Map<RentViewModel, Rent>(rentVM));
     rentServices.Save();
     return RedirectToAction("Index");
 }
Exemplo n.º 4
0
 //--------------REVIEW RENT--------------//
 public ActionResult ReviewRent(RentViewModel rentVM)
 {
     return View(rentVM);
 }
Exemplo n.º 5
0
 public ActionResult SelectClient(RentViewModel rentVM)
 {
     return RedirectToAction("SearchCar", rentVM);
 }
Exemplo n.º 6
0
 public ActionResult SelectCar(RentViewModel rentVM)
 {
     return RedirectToAction("ReviewRent", rentVM);
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 //--------------SEARCH CAR--------------//
 public ActionResult SearchCar(RentViewModel rentVM)
 {
     return View(Mapper.Map<Rent, RentViewModel>(new Rent()));
 }