예제 #1
0
        public void TestAddRent()
        {
            long             customerId       = 1;
            CustomerRentInfo customerRentInfo = new CustomerRentInfo()
            {
                CustomerPaidMoney = 100, CustomerPCType = "Chrome", CustomerPoints = 2, CustomerRentedProduct = ProductType.Heavy, Name = "Bulduser", RentalPeriod = 1
            };

            Assert.True(manager.AddRent(customerId, customerRentInfo));
        }
        public IActionResult AddRent([FromBody] RentedInfo data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            try
            {
                var IsAdded = _manager.AddRent(data.CustomerId, data.RentedData);
                return(Ok(IsAdded));
            }
            catch (Exception ex)
            {
                logger.LogError("AddRent Action" + ex.Message);
            }

            return(BadRequest());
        }