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"));
        }
Exemple #2
0
 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
     });
 }