public JsonResult CheckPower(string username_v, string password_v) { int username = int.Parse(username_v); string password = password_v; Session["username"] = username; SCS_Login sCS_Login = db.SCS_Login.Where(c => c.学号 == username && c.密码 == password).FirstOrDefault(); if (sCS_Login == null) { return(Json(null)); } if (sCS_Login.激活状态 == 0) { sCS_Login.激活状态 = 1; db.SCS_Login.Add(sCS_Login); db.SaveChanges(); return(Json(0)); } return(Json(1)); }
public ActionResult DeleteConfirmed(int id) { SCS_Login sCS_Login = db.SCS_Login.Find(id); db.SCS_Login.Remove(sCS_Login); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,学号,密码,姓名,激活状态")] SCS_Login sCS_Login) { if (ModelState.IsValid) { db.Entry(sCS_Login).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sCS_Login)); }
public ActionResult Create([Bind(Include = "id,学号,密码,姓名,激活状态")] SCS_Login sCS_Login) { if (ModelState.IsValid) { db.SCS_Login.Add(sCS_Login); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sCS_Login)); }
// GET: AddStudents/SCS_Login/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SCS_Login sCS_Login = db.SCS_Login.Find(id); if (sCS_Login == null) { return(HttpNotFound()); } return(View(sCS_Login)); }
public JsonResult CheckPower_Register(string password_1) { string password = password_1; int user_Login = Convert.ToInt32(Session["username"]); var result = db.SCS_Login.SingleOrDefault(p => p.学号 == user_Login); SCS_Login tb = db.SCS_Login.Find(result.id); tb.密码 = password; db.Entry(tb).State = EntityState.Modified; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; return(Json(true)); }