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)); }