public ActionResult Edit(int?id) { _Areas info = new _Areas(); using (MyContext db = new MyContext()) { info = db._Areas.Where(x => x.ARID == id).FirstOrDefault(); } return(View(info)); }
public ActionResult DelArea(WeFunModel._Areas info) { string result = "Fail"; using (MyContext db = new MyContext()) { _Areas uinfo = db._Areas.Where(x => x.ARID == info.ARID).FirstOrDefault(); db._Areas.Remove(uinfo); int r = db.SaveChanges(); if (r > 0) { result = "Success"; } } return(Content(result)); }
public ActionResult EditArea(_Areas info) { string result = "Fail"; using (MyContext db = new MyContext()) { _Areas usinfo = db._Areas.Where(x => x.ARID == info.ARID).FirstOrDefault(); usinfo.ARName = info.ARName; usinfo.ARParent = info.ARParent; usinfo.ARIndex = info.ARIndex; usinfo.ARState = info.ARState; int r = db.SaveChanges(); if (r > 0) { result = "Success"; } } return(Content(result)); }