예제 #1
0
        public ActionResult Create(ContaModel model)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
        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() });
        }
예제 #4
0
        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() });
        }