public ActionResult AddDormAdmin(DormAdmin dormAdmin) { if (ModelState.IsValid) { db.DormAdmin.Add(dormAdmin); db.SaveChanges(); return(Content("<script>alert('添加成功!');location.href='/DormAdmin/Index';</script>")); } else { return(Content("<script>alert('添加失败!');location.href='/DormAdmin/Index';</script>")); } }
public ActionResult EditDormAdmin(DormAdmin dormAdmin) { db.Entry(dormAdmin).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Content("<script>alert('编辑成功!');location.href='/DormAdmin/Index';</script>")); }