public ActionResult ProvinceEdit(Province model) { var province = db.Provinces.Find(model.ID); if (ModelState.IsValid) { province.ProvinceName = model.ProvinceName; db.SaveChanges(); return Redirect("/Admin/Foundation/Province"); } else { ModelState.AddModelError("", "省份信息填写失败!"); } return View(province); }
public ActionResult ProvinceDelete(int id) { try { var province = new Province(); province = db.Provinces.Find(id); db.Provinces.Remove(province); db.SaveChanges(); return Content("ok"); } catch { return Content("err"); } }
public ActionResult ProvinceEdit(int id) { var province = new Province(); province = db.Provinces.Find(id); return View(province); }
public ActionResult AddProvince(Province model) { if (ModelState.IsValid) { var province = new Province(); province.ProvinceName = model.ProvinceName; db.Provinces.Add(province); db.SaveChanges(); return Redirect("/Admin/Foundation/Province"); } else { ModelState.AddModelError("", "省份信息填写失败!"); } return View(); }