Пример #1
0
        public DBEntity Actualizar(TarifasEntity entity)
        {
            try
            {
                var result = sql.QueryExecute("TarifasActualizar", new
                {
                    entity.IdTarifa,
                    entity.Tarifas,
                    entity.Ofertas,
                    entity.MesesDuracion,
                    entity.InclusionBebes,
                    entity.PrecioTarifa,
                    entity.DescripcionOfertas,
                    entity.EstadoOfertas
                });


                return(result);
            }
            catch (Exception ex)
            {
                return(new DBEntity {
                    CodeError = ex.HResult, MsgError = ex.Message
                });
            }
        }
Пример #2
0
        public ActionResult Save(TarifasEntity entity)
        {
            try
            {
                var result = new DBEntity();

                if (entity.IdTarifa.HasValue)
                {
                    result          = IApp.tarifasService.Actualizar(entity);
                    TempData["msg"] = "Se Actualizo el registro con exito!";
                }
                else
                {
                    result          = IApp.tarifasService.Insertar(entity);
                    TempData["msg"] = "Se agrego 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 ActionResult Edit(int?id)
        {
            this.SessionOnline();

            var entity = new TarifasEntity();

            try
            {
                ViewBag.Form = false;
                if (id.HasValue)
                {
                    //editar
                    ViewBag.Form = true;

                    entity = IApp.tarifasService.ObtenerLista(id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }


            return(View(entity));
        }
Пример #4
0
        public DBEntity Eliminar(TarifasEntity entity)
        {
            try
            {
                var result = sql.QueryExecute("TarifasEliminar", new
                {
                    entity.IdTarifa
                });


                return(result);
            }
            catch (Exception ex)
            {
                return(new DBEntity {
                    CodeError = ex.HResult, MsgError = ex.Message
                });
            }
        }