public ActionResult Edit(string UserName) { var tum = tub.GetTeacherUserModel(UserName); if (tum != null) { ViewBag.TeacherID = new SelectList(tb.GetTeachers(), "ID", "TeacherName", tum.TeacherID); return(View(tum)); } else { return(RedirectToAction("Index")); } }
/// <summary> /// 验证用户名是否存在 /// </summary> /// <param name="UserName">传过来的用户名</param> /// <returns></returns> public ActionResult ValidateUserName(string UserName) { var tum = tub.GetTeacherUserModel(UserName); var teavalue = tum == null ? false : true; var stuvalue = sb.ValidateStuUserName(UserName); if (teavalue || stuvalue) { return(new JsonResult { Data = true, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } else { return(new JsonResult { Data = false, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }