public ActionResult CloseRent(RentView rentView) { RentParametersBll parameters = new RentParametersBll { CustomerEmail = rentView.Customer.Email, OfferId = rentView.OfferId }; RentBll rentBll = _sharingService.GetOpenRentByOfferId(parameters); if (rentBll == null) { return(RedirectToAction("CustomerNotFound")); } int cost = rentBll.GetShareCost(); _sharingService.CloseRent(rentBll); rentView.Cost = cost; rentView.EndDate = rentBll.EndDate; rentView.StartDate = rentBll.StartDate; rentView.InsuranceCase = rentBll.InsuranceCase; TempData["model"] = rentView; return(RedirectToAction("SharingCost")); }
public void CloseRent(RentBll rent) { rent.Cost = rent.GetShareCost(); rent.EndDate = DateTime.Now; _dataSource.CloseRent( new Rent(rent.Id, rent.OfferBll.Id, rent.StartDate, rent.Customer.Email, rent.InsuranceCase) { Cost = rent.Cost, EndDate = rent.EndDate }); }
public ActionResult CreateRent(RentView rentView) { CustomerBll customerBll = new CustomerBll { FirstName = rentView.Customer.FirstName, Surname = rentView.Customer.Surname, Email = rentView.Customer.Email }; RentBll rentBll = new RentBll(_sharingService.GetOfferById(rentView.OfferId), rentView.Customer.Email, rentView.InsuranceCase) { Customer = customerBll }; _sharingService.CreateRent(rentBll); return(Redirect("/Home/Index")); }
public RentController(RentBll _bll) { bll = _bll; }
public void CreateRent(RentBll rent) { AddNewCustomer(rent.Customer); _dataSource.CreateRent(new Rent(rent.Id, rent.OfferBll.Id, rent.StartDate, rent.Customer.Email, rent.InsuranceCase)); }