public ActionResult DeleteConfirmed(int id) { InvalidAssociation iv = inv.GetById(id); inv.Delete(iv); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InvalidAssociation iv = inv.GetById(id); if (iv == null) { return(HttpNotFound()); } return(View(iv)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InvalidAssociation iv = inv.GetById(id); if (iv == null) { return(HttpNotFound()); } PopulateVehicleTypesDropDownList(iv.VehicleTypeId); PopulateTasksDropDownList(iv.TaskId); return(View(iv)); }
public ActionResult Create([Bind(Include = "InvalidAssociationId,VehicleTypeId,TaskId")] InvalidAssociation iv) { try { if (ModelState.IsValid) { inv.Save(iv); return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("", "Unable to save changes due to following error " + ex.Message); } PopulateVehicleTypesDropDownList(iv.VehicleTypeId); PopulateTasksDropDownList(iv.TaskId); return(View(iv)); }
public ActionResult EditPost(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InvalidAssociation ivToUpdate = inv.GetById(id); if (TryUpdateModel(ivToUpdate, "", new string[] { "VehicleTypeId", "TaskId" })) { try { inv.Save(); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", "Unable to save changes due to following error " + ex.Message); } } PopulateVehicleTypesDropDownList(ivToUpdate.VehicleTypeId); PopulateTasksDropDownList(ivToUpdate.TaskId); return(View(ivToUpdate)); }