public ActionResult DeleteConfirmed(int id) { MunicipalityRegion municipalityRegion = db.MunicipalityRegion.Find(id); db.MunicipalityRegion.Remove(municipalityRegion); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MunicipalyRegionId,MunicipalityId,RegionId")] MunicipalityRegion municipalityRegion) { if (ModelState.IsValid) { db.Entry(municipalityRegion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MunicipalityId = new SelectList(db.Municipalitys, "MunicipalityId", "Name", municipalityRegion.MunicipalityId); ViewBag.RegionId = new SelectList(db.Region, "RegionId", "Name", municipalityRegion.RegionId); return(View(municipalityRegion)); }
// GET: MunicipalityRegions/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MunicipalityRegion municipalityRegion = db.MunicipalityRegion.Find(id); if (municipalityRegion == null) { return(HttpNotFound()); } return(View(municipalityRegion)); }
// GET: MunicipalityRegions/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MunicipalityRegion municipalityRegion = db.MunicipalityRegion.Find(id); if (municipalityRegion == null) { return(HttpNotFound()); } ViewBag.MunicipalityId = new SelectList(db.Municipalitys, "MunicipalityId", "Name", municipalityRegion.MunicipalityId); ViewBag.RegionId = new SelectList(db.Region, "RegionId", "Name", municipalityRegion.RegionId); return(View(municipalityRegion)); }