Пример #1
0
        // GET: Loans/Details/5
        public async Task <IActionResult> Details(int id)
        {
            var loan = loanService.GetLoanById(id);

            if (loan == null)
            {
                return(NotFound());
            }

            var vm = new DetailsLoanVm();

            vm.LoanBooks        = loan.LoanBooks;
            vm.ID               = loan.ID;
            vm.Member           = loan.Member;
            vm.MemberID         = loan.MemberID;
            vm.TimeOfLoan       = loan.TimeOfLoan;
            vm.TimeToReturnBook = loan.TimeToReturnBook;
            if (vm.TimeToReturnBook < DateTime.Today && vm.LoanBooks.Count > 0)
            {
                vm.Latefee = loanService.CalculateLateFee(vm.TimeToReturnBook);
            }


            return(View(vm));
        }