public ActionResult AddAdmin(Shopping.Models.Admin admin) { admin.CreateTime = DateTime.Now; db.Admins.Add(admin); db.SaveChanges(); var id = db.Admins.Max(x => x.AdminID); return(Content(id.ToString())); }
//验证管理员名称是否存在 public ActionResult CheckName(Shopping.Models.Admin admin) { string flag = "ok"; if (db.Admins.FirstOrDefault(a => a.AdminName == admin.AdminName) != null) { flag = "error"; } return(Content(flag)); }