public ActionResult Create(ContaModel model) { try { // TODO: Add insert logic here return RedirectToAction("Index"); } catch { return View(); } }
private ActionResult ContextDependentView(ContaModel model = null) { string actionName = ControllerContext.RouteData.GetRequiredString("action"); if (Request.QueryString["content"] != null) { ViewBag.FormAction = "Json" + actionName; return PartialView(model); } else { ViewBag.FormAction = actionName; return View(model); } }
public JsonResult JsonEdit(long id, ContaModel model) { if (ModelState.IsValid) { CONTA conta = contaRepository.FindById(id, User.Identity.Name); conta.Update(model.Nome, model.DataInicial, model.SaldoInicial); contaRepository.Save(); return Json(new { success = true }); } return Json(new { errors = GetErrorsFromModelState() }); }
public JsonResult JsonCreate(ContaModel model) { if (ModelState.IsValid) { CONTA conta = new CONTA(model, User.Identity.Name); contaRepository.InsertOnSubmit(conta); contaRepository.Save(); return Json(new { success = true }); } return Json(new { errors = GetErrorsFromModelState() }); }