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)); }
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)); }
public ActionResult DeleteConfirmed(int id) { Contravention contravention = db.Contraventions.Find(id); db.Contraventions.Remove(contravention); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
// 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)); }
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; } }
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)); }