コード例 #1
0
        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"));
        }
コード例 #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
     });
 }
コード例 #3
0
        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"));
        }
コード例 #4
0
 public RentController(RentBll _bll)
 {
     bll = _bll;
 }
コード例 #5
0
 public void CreateRent(RentBll rent)
 {
     AddNewCustomer(rent.Customer);
     _dataSource.CreateRent(new Rent(rent.Id, rent.OfferBll.Id, rent.StartDate, rent.Customer.Email, rent.InsuranceCase));
 }