コード例 #1
0
        public JsonResult EditContravencion(Contravention contravention)
        {
            if (contravention == null)
            {
                return(Json(new { responseCode = "-10" }));
            }

            //db.Entry(tipo).State = EntityState.Modified;

            //Solo actualizo el campo descripcion
            db.Contraventions.Attach(contravention);
            db.Entry(contravention).Property(x => x.NroArticulo).IsModified = true;
            db.Entry(contravention).Property(x => x.Descripcion).IsModified = true;

            db.SaveChanges();

            //Audito
            AuditHelper.Auditar("Modificacion", contravention.Id.ToString(), "Contravention", ModuleDescription, WindowDescription);


            var responseObject = new
            {
                responseCode = 0
            };

            return(Json(responseObject));
        }
コード例 #2
0
        public JsonResult CreateContravencion(Contravention contravention)
        {
            if (contravention == null)
            {
                return(Json(new { responseCode = "-10" }));
            }

            contravention.Enable    = true;
            contravention.FechaAlta = DateTime.Now;

            db.Contraventions.Add(contravention);

            db.SaveChanges();


            //Audito
            AuditHelper.Auditar("Alta", contravention.Id.ToString(), "Contravention", ModuleDescription, WindowDescription);


            var responseObject = new
            {
                responseCode = 0
            };

            return(Json(responseObject));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Contravention contravention = db.Contraventions.Find(id);

            db.Contraventions.Remove(contravention);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,NroArticulo,Descripcion,FechaAlta,Enable")] Contravention contravention)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contravention).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contravention));
 }
コード例 #5
0
        public ActionResult Create([Bind(Include = "Id,NroArticulo,Descripcion,FechaAlta,Enable")] Contravention contravention)
        {
            if (ModelState.IsValid)
            {
                db.Contraventions.Add(contravention);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contravention));
        }
コード例 #6
0
        // GET: Contraventions/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Contravention contravention = db.Contraventions.Find(id);

            if (contravention == null)
            {
                return(HttpNotFound());
            }
            return(View(contravention));
        }
コード例 #7
0
        public JsonResult GetContravencion(int id)
        {
            Contravention contravention = new Contravention();

            try
            {
                contravention = db.Contraventions.Find(id);
                var json = JsonConvert.SerializeObject(contravention);

                return(Json(contravention, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #8
0
        public JsonResult DeleteContravencion(int id)
        {
            if (id == 0)
            {
                return(Json(new { responseCode = "-10" }));
            }

            Contravention contravention = db.Contraventions.Find(id);

            db.Contraventions.Remove(contravention);
            db.SaveChanges();

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

            var responseObject = new
            {
                responseCode = 0
            };

            return(Json(responseObject));
        }