Пример #1
0
        public IActionResult Checkout(ItemViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var student = _studentRep.Get(viewModel.Item.BorrowerId);
                var item    = _itemRep.GetById(viewModel.Id);
                var months  = viewModel.Months;
                var owner   = item.Employee.Name;

                _checkoutRep.CheckoutItem(item, student, months);

                if (viewModel.Donation)
                {
                    return(RedirectToAction("ProcessCheckout", "Crypto", new { employee = owner, amount = viewModel.Amount, student = student.Name }));
                }
                return(RedirectToAction("Index"));
            }
            viewModel.Students = _studentRep.GetAll();
            return(View(viewModel));
        }