コード例 #1
0
        //续借
        public ActionResult BorrowAgain(int Id, Reader reader)
        {
            Book book = repository.FindBookById(Id);

            if (repository.Borrows.FirstOrDefault(b => b.BookId == book.Id && b.ReaderId == reader.Id).WhetherToRenew == 3)
            {
                TempData["msg"] = string.Format("抱歉,'{0}'的续借上限次数为三次", book.Name);
            }
            else
            {
                borrowProcessor.ProcessBorrowAgain(book, reader);
            }
            return(RedirectToAction("Borrowing", reader));
        }