Esempio n. 1
0
        private static void AddNewRentTest(IRentService rentService)
        {
            //Add new rent......
            var result = rentService.Add(exRent);

            Console.WriteLine(result.Message);
        }
Esempio n. 2
0
        public IActionResult Add(Rental rental)
        {
            var result = _rentalService.Add(rental);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public async Task <IActionResult> AddItems([FromQuery] string email)
        {
            try
            {
                var result = await _rentService.Add(email);

                return(result ? (IActionResult)Ok() : BadRequest());
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }
        public IActionResult Add(RentCustomerBranchUserView Rtmdl)
        {
            var rent = new Rent();

            rent.CustomerID        = Rtmdl.CustomerID;
            rent.DamagePrice       = Rtmdl.DamagePrice;
            rent.DelayFine         = Rtmdl.DelayFine;
            rent.RentBranchID      = Rtmdl.BranchID;
            rent.RemaindDebt       = Rtmdl.RemainDebt;
            rent.DeliveredBranchID = Rtmdl.BranchID;
            rent.TotalRentPrice    = Rtmdl.TotalRentPrice;
            rent.UserID            = Rtmdl.UserID;
            rent.CarID             = Rtmdl.CarID;
            rent.RentStartDate     = DateTime.Now;
            rent.RentEndDate       = DateTime.Now.AddDays(Rtmdl.HowManyDays);

            _service.Add(rent);
            return(RedirectToAction("Index"));
        }