public JsonResult Create(FormCollection collection)
 {
     var b = new Borrower();
     if (TryUpdateModel(b))
     {
         borrowerRepository.Insert(b);
         if (borrowerRepository.Commit())
         {
             return Json(b);
         }
     }
     return Json(b);
 }
 public ActionResult Create(FormCollection collection)
 {
     var b = new Borrower();
     if (TryUpdateModel(b))
     {
         borrowerRepository.Insert(b);
         if (borrowerRepository.Commit())
         {
             return RedirectToAction("Index");
         }
         ModelState.AddModelError("db", borrowerRepository.Errors);
     }
     return RedirectToAction("Create", b);
 }
 public ActionResult Create()
 {
     var b = new Borrower();
     UpdateLists(b);
     return View(b);
 }
 private void UpdateLists(Borrower _borrower)
 {
     ViewBag.Books = bookCopysRepository().GetAll().ToDropDown(c => c.ID.ToString(), c => c.Book.Title,
                                                               c => _borrower.BookCopyID == c.ID);
     ViewBag.Students = studentRepository().GetAll().ToDropDown(c => c.ID.ToString(), c => c.FullName,
                                                                c => _borrower.StudentID == c.ID);
 }