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 RentBll GetOpenRentByOfferId(RentParametersBll parameters) { Rent rent = _dataSource.GetOpenRentByOfferId(new RentParameters { CustomerEmail = parameters.CustomerEmail, OfferId = parameters.OfferId }); if (rent == null) { return(null); } OfferBll offerBll = FactoryClass.CreateChild(_dataSource.GetOfferById(parameters.OfferId)); return(new RentBll(offerBll, rent.CustomerEmail, rent.InsuranceCase) { StartDate = rent.StartDate, Id = rent.Id }); }