public Afeccion Agregar(Afeccion afeccion)
 {
     using (var cnx = Conexion.Open)
     {
         cnx.Afeccion.InsertOnSubmit(afeccion);
         cnx.SubmitChanges();
     }
     return(afeccion);
 }
        public Boolean EditarAfeccion(Afeccion afeccion)
        {
            using (var cnx = Conexion.Open)
            {
                var afeccionAux = cnx.Afeccion.FirstOrDefault(x => x.Codigo == afeccion.Codigo);
                afeccionAux.Nombre      = afeccion.Nombre;
                afeccionAux.Estado      = afeccion.Estado;
                afeccionAux.Detalle     = afeccion.Detalle;
                afeccionAux.FechaInicio = afeccion.FechaInicio;
                afeccionAux.FechaFin    = afeccion.FechaFin;
                cnx.SubmitChanges();
            }

            return(true);
        }
示例#3
0
        public JsonResult ObtenerAfeccion(int codigo)
        {
            Afeccion registro = afecciones.ObtenerAfeccion(codigo);

            return(Json(new
            {
                Codigo = registro.Codigo,
                Nombre = registro.Nombre,
                Paciente = registro.Paciente,
                Estado = registro.TipoEstadoAfeccion.Codigo,
                Detalle = registro.Detalle,
                FechaInicio = registro.FechaInicio,
                FechaFin = registro.FechaFin
            }, JsonRequestBehavior.AllowGet));
        }
        public Afeccion ObtenerAfeccion(int codigo)
        {
            Afeccion afeccion = Conexion.Open.Afeccion.FirstOrDefault(x => x.Codigo == codigo);

            return((afeccion != null) ? afeccion : new Afeccion());
        }
示例#5
0
 public JsonResult EditarAfeccion(Afeccion afeccion)
 {
     afecciones.EditarAfeccion(afeccion);
     return(Json(true));
 }
示例#6
0
        public JsonResult GuardarAfeccion(Afeccion afeccion)
        {
            var afeccionCodigo = afecciones.Agregar(afeccion).Codigo;

            return(Json(new { Resultado = true, CodigoAfeccion = afeccionCodigo }));
        }