Example #1
0
        public JsonResult Get(int id)
        {
            try
            {
                var modelo = db.SupplieMedicals.Where(x => x.Id == id).Select(c => new { c.Id, c.Descripcion }).FirstOrDefault();

                SupplieMedical types = new SupplieMedical
                {
                    Id          = modelo.Id,
                    Descripcion = modelo.Descripcion
                };

                return(Json(types, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public JsonResult Edit(SupplieMedical modelo)
        {
            if (modelo == null)
            {
                return(Json(new { responseCode = "-10" }));
            }
            modelo.Enable          = true;
            db.Entry(modelo).State = EntityState.Modified;
            db.SaveChanges();

            //Audito
            AuditHelper.Auditar("Modificacion", modelo.Id.ToString(), "SupplieMedical", ModuleDescription, WindowDescription);

            var responseObject = new
            {
                responseCode = 0
            };

            return(Json(responseObject));
        }
Example #3
0
        public JsonResult Create(SupplieMedical modelo)
        {
            if (modelo == null)
            {
                return(Json(new { responseCode = "-10" }));
            }

            modelo.Enable = true;
            db.SupplieMedicals.Add(modelo);
            db.SaveChanges();

            //Audito
            AuditHelper.Auditar("Alta", modelo.Id.ToString(), "SupplieMedical", ModuleDescription, WindowDescription);

            var responseObject = new
            {
                responseCode = 0
            };

            return(Json(responseObject));
        }
Example #4
0
        public JsonResult Delete(int id)
        {
            if (id == 0)
            {
                return(Json(new { responseCode = "-10" }));
            }

            SupplieMedical modelo = db.SupplieMedicals.Find(id);

            modelo.Enable          = false;
            db.Entry(modelo).State = EntityState.Modified;
            db.SaveChanges();

            //Audito
            AuditHelper.Auditar("Baja", id.ToString(), "SupplieMedical", ModuleDescription, WindowDescription);

            var responseObject = new
            {
                responseCode = 0
            };

            return(Json(responseObject));
        }