public ActionResult Crear(Proyecto proyecto)
        {
            try
            {
                if (proyecto.NombreProyecto == null)
                {
                    return(Json(new { ok = false, msg = "Debe ingresar el nombre del proyecto" }, JsonRequestBehavior.AllowGet));
                }

                ProyectoCN.Agregar(proyecto);
                return(Json(new { ok = true, toRedirect = Url.Action("Index") }, JsonRequestBehavior.AllowGet));
                //return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                return(Json(new { ok = false, msg = ex.Message }, JsonRequestBehavior.AllowGet));
                //ModelState.AddModelError("", "Ocurrió un error al agregar un Proyecto");
                //return View();
            }
        }
Exemplo n.º 2
0
        public ActionResult Crear(Proyecto proyecto)
        {
            try
            {
                if (proyecto.NombreProyecto == null)
                {
                    return(Json(new { ok = false, msg = "Debe ingresar el nombre del proyecto" }, JsonRequestBehavior.AllowGet));
                }

                /* System.Threading.Thread.Sleep(2000);  suspende por dos segundos la carga del formulario para hacer prueba*/

                ProyectoCN.Agregar(proyecto);
                return(Json(new { ok = true, toRedirect = Url.Action("Inicio") }, JsonRequestBehavior.AllowGet));
                //return RedirectToAction("Inicio");
            }
            catch (Exception ep)
            {
                return(Json(new { ok = false, msg = ep.Message }, JsonRequestBehavior.AllowGet));
                //ModelState.AddModelError("", "ocurrio un error al agregar un proyecto ");
                //return View();
            }
        }