예제 #1
0
        public DBEntity Actualizar(BebeEntity entity)
        {
            try
            {
                var result = sql.QueryExecute("BebeActualizar", new
                {
                    entity.IdBebe,
                    entity.NombreBebe,
                    entity.Apellido1Bebe,
                    entity.Apellido2Bebe,
                    entity.NombrePadreMadreBebe,
                    entity.FechaNacimientoBebe,
                    entity.InscripcionClasesBebe,
                    entity.AforoDisponibleBebe,
                    entity.EstadoBebe
                });


                return(result);
            }
            catch (Exception ex)
            {
                return(new DBEntity {
                    CodeError = ex.HResult, MsgError = ex.Message
                });
            }
        }
예제 #2
0
        public ActionResult Save(BebeEntity entity)
        {
            try
            {
                var result = new DBEntity();

                if (entity.IdBebe.HasValue)
                {
                    result          = IApp.bebeService.Actualizar(entity);
                    TempData["msg"] = "Se Actualizo el registro con exito!";
                }
                else
                {
                    result          = IApp.bebeService.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 BebeEntity();

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

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


            return(View(entity));
        }
예제 #4
0
        public DBEntity Eliminar(BebeEntity entity)
        {
            try
            {
                var result = sql.QueryExecute("BebeEliminar", new
                {
                    entity.IdBebe
                });


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