public ActionResult DeleteConfirmed(int id) { MND_TBL mND_TBL = db.MND_TBLs.Find(id); db.MND_TBLs.Remove(mND_TBL); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: MND_TBL/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MND_TBL mND_TBL = db.MND_TBLs.Find(id); if (mND_TBL == null) { return(HttpNotFound()); } return(View(mND_TBL)); }
// GET: MND_TBL/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MND_TBL mND_TBL = db.MND_TBLs.Find(id); if (mND_TBL == null) { return(HttpNotFound()); } ViewBag.Gov_tblId = new SelectList(db.Gov_tbls, "Id", "Gov_Name", mND_TBL.Gov_tblId); ViewBag.MND_CATId = new SelectList(db.MND_CATs, "Id", "Category", mND_TBL.MND_CATId); return(View(mND_TBL)); }
public ActionResult Create(MND_TBL mND_TBL, HttpPostedFileBase upload) { if (ModelState.IsValid) { string path = Path.Combine(Server.MapPath("~/Uploads"), upload.FileName); upload.SaveAs(path); mND_TBL.MND_REGON = upload.FileName; db.MND_TBLs.Add(mND_TBL); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Gov_tblId = new SelectList(db.Gov_tbls, "Id", "Gov_Name", mND_TBL.Gov_tblId); ViewBag.MND_CATId = new SelectList(db.MND_CATs, "Id", "Category", mND_TBL.MND_CATId); return(View(mND_TBL)); }
public ActionResult Edit(MND_TBL mND_TBL, HttpPostedFileBase upload) { if (ModelState.IsValid) { string oldPath = Path.Combine(Server.MapPath("~/Uploads"), mND_TBL.MND_REGON); if (upload != null) { System.IO.File.Delete(oldPath); string path = Path.Combine(Server.MapPath("~/Uploads"), upload.FileName); upload.SaveAs(path); mND_TBL.MND_REGON = upload.FileName; } db.Entry(mND_TBL).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Gov_tblId = new SelectList(db.Gov_tbls, "Id", "Gov_Name", mND_TBL.Gov_tblId); ViewBag.MND_CATId = new SelectList(db.MND_CATs, "Id", "Category", mND_TBL.MND_CATId); return(View(mND_TBL)); }