Пример #1
0
        public void CreateRentTest(int gameId, int personId, int rentYear, int rentMonth, int rentDay, int returnYear, int returnMonth, int returnDay)
        {
            DateTime rentDate   = new DateTime(rentYear, rentMonth, rentDay);
            DateTime returnDate = new DateTime(returnYear, returnMonth, returnDay);
            Rental   r          = new Rental()
            {
                GameRef    = gameId,
                PersonRef  = personId,
                RentDate   = rentDate,
                ReturnDate = returnDate
            };

            rentLogic.NewRent(r);

            var all = rentLogic.GetAllRentals();
            int id  = 0;

            foreach (var item in all)
            {
                if (item.RentDate == rentDate)
                {
                    id = item.Id;
                }
            }
            Assert.That(rentLogic.GetRentById(id).Id, Is.EqualTo(id));
        }
Пример #2
0
        public IActionResult NewRental(int PersonRef, int GameRef, DateTime RentDate, DateTime ReturnDate)
        {
            Rental r = new Rental()
            {
                PersonRef  = PersonRef,
                GameRef    = GameRef,
                RentDate   = RentDate,
                ReturnDate = ReturnDate
            };

            rentLogic.NewRent(r);
            return(RedirectToAction(nameof(GetRentals)));
        }