예제 #1
0
        public DBEntity Actualizar(PadronElectoralEntity entity)
        {
            try
            {
                var result = sql.QueryExecute("PadronElectoralActualizar", new
                {
                    entity.IdCivil,
                    entity.Cedula,
                    entity.Nombre,
                    entity.Apellido1,
                    entity.Apellido2,
                    entity.Edad,
                    entity.Estado
                });


                return(result);
            }
            catch (Exception ex)
            {
                return(new DBEntity {
                    CodeError = ex.HResult, MsgError = ex.Message
                });
            }
        }
        public ActionResult Save(PadronElectoralEntity entity)
        {
            try
            {
                var result = new DBEntity();
                if (entity.IdCivil.HasValue)
                {
                    result          = IApp.PadronElectoralServis.Actualizar(entity);
                    TempData["msg"] = "Se actualizo el registro con exito!";
                }
                else
                {
                    result          = IApp.PadronElectoralServis.Insertar(entity);
                    TempData["msg"] = "Se inserto el registro con exito!";
                }

                if (result.CodeError != 0)
                {
                    throw new Exception(result.MsgError);
                }

                return(RedirectToAction("index"));
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
예제 #3
0
        public DBEntity Eliminar(PadronElectoralEntity entity)
        {
            try
            {
                var result = sql.QueryExecute("PadronElectoralEliminar", new
                {
                    entity.IdCivil
                });


                return(result);
            }
            catch (Exception ex)
            {
                return(new DBEntity {
                    CodeError = ex.HResult, MsgError = ex.Message
                });
            }
        }
        public ActionResult Edit(int?id)
        {
            var entity = new PadronElectoralEntity();

            try
            {
                ViewBag.Form = false;
                if (id.HasValue)
                {
                    ViewBag.Form = true;
                    entity       = IApp.PadronElectoralServis.ObtenerLista(id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }

            return(View(entity));
        }