public ActionResult edit(MA_CARGO model)
 {
     if (ModelState.IsValid)
     {
         if (repository.edit(model) > 0)
         {
             return(RedirectToAction("index"));
         }
         else
         {
             ModelState.AddModelError("", "Ocurrrio un erro internamente comuniquese con la area de Sistemas con J.Salinas");
             return(View(model));
         }
     }
     else
     {
         return(View(model));
     }
 }
Exemple #2
0
        public List <MA_CARGO> listarCargo()
        {
            List <MA_CARGO> lista = new List <MA_CARGO>();
            Database        db    = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings["conecion"].ToString());
            DbCommand       cmd   = db.GetStoredProcCommand("[MA_SP_LISTAR_CARGO]");

            using (IDataReader lee = db.ExecuteReader(cmd))
            {
                while (lee.Read())
                {
                    MA_CARGO entity = new MA_CARGO();
                    entity.I_COD_CARGO = Convert.ToInt32(lee["I_COD_CARGO"].ToString());
                    entity.V_DES_CARGO = lee["V_DES_CARGO"].ToString();
                    lista.Add(entity);
                }
            }

            return(lista);
        }
 public ActionResult guardar(MA_CARGO entity)
 {
     return(Json(repository.create(entity), JsonRequestBehavior.AllowGet));
 }