public ActionResult DeleteConfirmed(int id) { AllowedViolation allowedviolation = db.AllowedViolations.Find(id); db.AllowedViolations.Remove(allowedviolation); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,ServiceTypeId,ViolationTypeId")] AllowedViolation allowedviolation) { if (ModelState.IsValid) { db.Entry(allowedviolation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ServiceTypeId = new SelectList(db.ServiceTypes, "Id", "Name", allowedviolation.ServiceTypeId); ViewBag.ViolationTypeId = new SelectList(db.ViolationTypes, "Id", "Name", allowedviolation.ViolationTypeId); return(View(allowedviolation)); }
public ActionResult Create([Bind(Include = "Id,ServiceTypeId,ViolationTypeId")] AllowedViolation allowedviolation) { if (ModelState.IsValid) { db.AllowedViolations.Add(allowedviolation); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ServiceTypeId = new SelectList(db.ServiceTypes, "Id", "Name", allowedviolation.ServiceTypeId); ViewBag.ViolationTypeId = new SelectList(db.ViolationTypes, "Id", "Name", allowedviolation.ViolationTypeId); return(View(allowedviolation)); }
// GET: /AllowedViolation/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AllowedViolation allowedviolation = db.AllowedViolations.Find(id); if (allowedviolation == null) { return(HttpNotFound()); } return(View(allowedviolation)); }
// GET: /AllowedViolation/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AllowedViolation allowedviolation = db.AllowedViolations.Find(id); if (allowedviolation == null) { return(HttpNotFound()); } ViewBag.ServiceTypeId = new SelectList(db.ServiceTypes, "Id", "Name", allowedviolation.ServiceTypeId); ViewBag.ViolationTypeId = new SelectList(db.ViolationTypes, "Id", "Name", allowedviolation.ViolationTypeId); return(View(allowedviolation)); }