예제 #1
0
        // GET: Erp/ReqAutorizante/Create
        public ActionResult Create()
        {
            var usuario = login.GetUsuario(System.Web.HttpContext.Current.User.Identity.Name);

            var item = new ReqAutorizante
            {
                AlteradoEm  = DateTime.Now,
                AlteradoPor = usuario.Id,
                EmpresaId   = usuario.IdEmpresa
            };

            return(PartialView(item));
        }
예제 #2
0
        public ActionResult Create(ReqAutorizante item)
        {
            try
            {
                item.AlteradoEm = DateTime.Now;
                TryUpdateModel(item);

                if (ModelState.IsValid)
                {
                    service.Gravar(item);
                    return(Json(new { success = true, data = getAutorizantes() }));
                }

                return(PartialView(item));
            }
            catch (ArgumentException e)
            {
                return(Json(new { error = e.Message }));
            }
        }