コード例 #1
0
        public ActionResult CustomerRents(int cstmrId, bool isCLosed = false)
        {
            List <VMRent> _vMrents = new List <VMRent>();

            List <BO.Rent> _rents = BL.BLRent.GetRentByCstmr(cstmrId, isCLosed);

            if (_rents.Count != 0)
            {
                foreach (BO.Rent item in _rents)
                {
                    VMRent _vmRent = new VMRent()
                    {
                        VehicleTypeId = item.VehicleTypeId, CstmrId = item.CstmrId, EmployeeId = item.EmployeeId, ReservationDate = item.ReservationDate, StartDate = item.StartDate, EndDate = item.EndDate, ToPay = item.ToPay, Paid = item.Paid
                    };
                    _vMrents.Add(_vmRent);
                }
                return(View(_vMrents));
            }
            return(RedirectToAction("Index", "Home"));
        }
コード例 #2
0
        public ActionResult Rent(VMvehicle vMvehicle)
        {
            if (ModelState.IsValid)
            {//TODO _rent.CstmrId  & _employeeId
                int     _cstmrId    = new int();
                int     _employeeId = new int();
                decimal _paid       = 0;

                BO.Rent _rent = new BO.Rent()
                {
                    VehicleTypeId = vMvehicle.TypeId, CstmrId = _cstmrId, EmployeeId = _employeeId, ReservationDate = DateTime.Now, StartDate = vMvehicle.StartDate, EndDate = vMvehicle.EndDate, ToPay = vMvehicle.PriceToPay, Paid = _paid
                };

                int _carNumber = BL.BLRent.CreateRent(_rent);

                VMRent _vmRent = new VMRent()
                {
                    CarNumber = _carNumber, VehicleTypeId = _rent.VehicleTypeId, CstmrId = _rent.CstmrId, EmployeeId = _rent.EmployeeId, ReservationDate = _rent.ReservationDate, StartDate = _rent.StartDate, EndDate = _rent.EndDate, ToPay = _rent.ToPay, Paid = _rent.Paid
                };

                return(View(_vmRent));    //rentConfirmation
            }
            return(RedirectToAction("Index", "Home"));
        }