コード例 #1
0
        public JsonResult Create(FormCollection collection)
        {
            var b = new Borrower();

            if (TryUpdateModel(b))
            {
                borrowerRepository.Insert(b);
                if (borrowerRepository.Commit())
                {
                    return(Json(b));
                }
            }
            return(Json(b));
        }
コード例 #2
0
        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));
        }