public ActionResult insert(string username, string userpwd, adminM MM) { if (username != null && userpwd != null) { var name_re = db.adminM.Where(e => e.adminName == username); if (name_re.ToList().Count > 0) { return(Json(new { s = "00" })); } var re = db.adminM.Where(e => e.adminName == username && e.adminPwd == userpwd); if (re.ToList().Count > 0) { return(Json(new { s = "1" })); } else { MM.adminName = username.ToString(); MM.adminPwd = userpwd.ToString(); db.adminM.Add(MM); db.SaveChanges(); return(Json(new { s = "ok" })); } } else { return(Json(new { s = "0" })); } }
public ActionResult Edit(adminM MM) { var re = db.adminM.Find(MM.adminID); UpdateModel(re); db.SaveChanges(); return(RedirectToAction("Index")); }