// GET: QUANHUYENs/Create public ActionResult Create() { QUANHUYEN obj = new QUANHUYEN(); obj.QH_MA = CreateID.CreateID_ByteText(); return(View(obj)); }
public ActionResult DeleteConfirmed(string id) { QUANHUYEN qUANHUYEN = db.QUANHUYENs.Find(id); db.QUANHUYENs.Remove(qUANHUYEN); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: QUANHUYENs/Delete/5 public ActionResult Delete(string id) { QUANHUYEN qUANHUYEN = db.QUANHUYENs.Find(id); var matp = qUANHUYEN.MATP; db.QUANHUYENs.Remove(qUANHUYEN); db.SaveChanges(); return(RedirectToAction("Details", "THANHPHOes", new { id = matp })); }
public ActionResult Edit([Bind(Include = "QH_MA,QH_TEN")] QUANHUYEN qUANHUYEN) { if (ModelState.IsValid) { db.Entry(qUANHUYEN).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(qUANHUYEN)); }
public ActionResult Create([Bind(Include = "QH_MA,QH_TEN")] QUANHUYEN qUANHUYEN) { if (ModelState.IsValid) { db.QUANHUYENs.Add(qUANHUYEN); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(qUANHUYEN)); }
public ActionResult Edit([Bind(Include = "MAQH,MATP,TENQH")] QUANHUYEN qUANHUYEN) { if (ModelState.IsValid) { db.Entry(qUANHUYEN).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", "THANHPHOes", new { id = qUANHUYEN.MATP })); } ViewBag.MATP = db.THANHPHOes.Find(qUANHUYEN.MATP); ViewBag.THANHPHO = db.QUANHUYENs.Where(m => m.MATP.Equals(qUANHUYEN.MATP)).ToList(); return(View(qUANHUYEN)); }
public ActionResult Create([Bind(Include = "MAQH,MATP,TENQH")] QUANHUYEN qUANHUYEN) { if (ModelState.IsValid) { qUANHUYEN.MAQH = GetNewId(); db.QUANHUYENs.Add(qUANHUYEN); db.SaveChanges(); return(RedirectToAction("Details", new { id = qUANHUYEN.MAQH })); } ViewBag.MATP = db.THANHPHOes.Find(qUANHUYEN.MATP); ViewBag.MAQH = GetNewId(); return(View(qUANHUYEN)); }
// GET: QUANHUYENs/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QUANHUYEN qUANHUYEN = db.QUANHUYENs.Find(id); if (qUANHUYEN == null) { return(HttpNotFound()); } return(View(qUANHUYEN)); }
// GET: QUANHUYENs/Details/5 public ActionResult Details(string id) { if (Session["admin"] == null) { return(RedirectToAction("LoginForm", "QuanTri")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QUANHUYEN qUANHUYEN = db.QUANHUYENs.Find(id); if (qUANHUYEN == null) { return(HttpNotFound()); } return(View(qUANHUYEN)); }
// GET: QUANHUYENs/Edit/5 public ActionResult Edit(string id) { if (Session["admin"] == null) { return(RedirectToAction("LoginForm", "QuanTri")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QUANHUYEN qUANHUYEN = db.QUANHUYENs.Find(id); if (qUANHUYEN == null) { return(HttpNotFound()); } ViewBag.MATP = db.THANHPHOes.Find(id); ViewBag.THANHPHO = db.QUANHUYENs.Where(m => m.MATP.Equals(qUANHUYEN.MATP)).ToList(); return(View(qUANHUYEN)); }