Exemple #1
0
 //[HttpGet]
 public ActionResult TakeBook(int bookId, string username)
 {
     if (!String.IsNullOrEmpty(username))
     {
         var book = GetBook(bookId);
         if ((int)book.Quantity > 0)
         {
             book.Quantity--;
             using (var repo = new BookRepository())
             {
                 repo.Edit(book);
                 repo.BindBookToUser(book.Id, username);
             }
         }
     }
     return(RedirectToAction("Index"));
 }