public ActionResult GetPersonalInfo(Admin adminInfo) { //数据库帮助类 ModelHelpers modelHelp = new ModelHelpers(); //获取用户(教师)cookie,cookie存储是ID try { string adminId = TakeCookie.GetCookie("userId"); adminInfo.Id = new Guid(adminId); adminInfo.Pwd = adminInfo.Pwd.Trim(); if (string.IsNullOrEmpty(adminInfo.Pwd) || adminInfo.Pwd == "不修改就不需要输入") { modelHelp.Modify <Admin>(adminInfo, new string[] { "Id", "Account", "UserName", "Sex" }); TempData["res"] = "修改成功"; return(RedirectToAction("GetPersonalInfo")); } modelHelp.Modify <Admin>(adminInfo, new string[] { "Id", "Account", "UserName", "Pwd", "Sex" }); TempData["res"] = "修改成功"; } catch (Exception) { TempData["res"] = "<font color='red'>修改失败,请点解cancel或刷新 后 重新输入!<font/>"; } return(RedirectToAction("GetPersonalInfo")); }
public ActionResult StudentCenter(StudentInfo studentInfo) { try { studentInfo.Id = new Guid(studentId); studentInfo.Pwd = studentInfo.Pwd.Trim(); if (string.IsNullOrEmpty(studentInfo.Pwd) || studentInfo.Pwd == "不修改就不需要输入") { mHelp.Modify <StudentInfo>(studentInfo, new string[] { "Id", "Account", "UserName", "Sex" }); TempData["res"] = "修改成功"; return(RedirectToAction("StudentCenter")); } mHelp.Modify <StudentInfo>(studentInfo, new string[] { "Id", "Account", "UserName", "Pwd", "Sex" }); TempData["res"] = "修改成功"; } catch (Exception) { TempData["res"] = "<font color='red'>修改失败,请点解cancel或刷新 后 重新输入!<font/>"; } return(RedirectToAction("StudentCenter")); }
public ActionResult GetPersonalInfo(TeacherInfo teacherInfo) { try { //获取用户(教师)cookie,cookie存储是ID string teacherId = TakeCookie.GetCookie("userId"); teacherInfo.Id = new Guid(teacherId); teacherInfo.Pwd = teacherInfo.Pwd.Trim(); if (string.IsNullOrEmpty(teacherInfo.Pwd) || teacherInfo.Pwd == "不修改就不需要输入") { modelHelp.Modify <TeacherInfo>(teacherInfo, new string[] { "Id", "Account", "UserName", "Sex" }); TempData["res"] = "修改成功"; return(RedirectToAction("GetPersonalInfo")); } modelHelp.Modify <TeacherInfo>(teacherInfo, new string[] { "Id", "Account", "UserName", "Pwd", "Sex" }); TempData["res"] = "修改成功"; } catch (Exception) { TempData["res"] = "<font color='red'>修改失败,请点解cancel或刷新 后 重新输入!<font/>"; } return(RedirectToAction("GetPersonalInfo")); }
// 发布课程 --内容 D大调 //判断是否全部填写完板块 public ActionResult CoursesPublish() { try { int courseId = int.Parse(Request.QueryString["id"]); Course course = db.Course.Where(c => c.Id == courseId).FirstOrDefault(); Module module = db.Module.Where(c => c.CourseId == courseId && c.ModuleTag == 5).FirstOrDefault(); if (module != null) { course.CourseStatus = 1; mHelper.Modify <Course>(course); } else { ViewBag.ModifyError = "保存失败!因为没有添加完所有模块!"; } } catch (Exception e) { } return(RedirectToAction("Courses")); }
public ActionResult GetPersonalInfo(Admin adminInfo) { //数据库帮助类 ModelHelpers modelHelp = new ModelHelpers(); //获取用户(教师)cookie,cookie存储是ID try { string adminId = TakeCookie.GetCookie("userId"); adminInfo.Id =new Guid( adminId); adminInfo.Pwd = adminInfo.Pwd.Trim(); if (string.IsNullOrEmpty(adminInfo.Pwd) || adminInfo.Pwd == "不修改就不需要输入") { modelHelp.Modify<Admin>(adminInfo, new string[] { "Id", "Account", "UserName", "Sex" }); TempData["res"] = "修改成功"; return RedirectToAction("GetPersonalInfo"); } modelHelp.Modify<Admin>(adminInfo, new string[] { "Id", "Account", "UserName", "Pwd", "Sex" }); TempData["res"] = "修改成功"; } catch (Exception) { TempData["res"] = "<font color='red'>修改失败,请点解cancel或刷新 后 重新输入!<font/>"; } return RedirectToAction("GetPersonalInfo"); }