public ActionResult EditPersonal(EditPersonalModel model) { var userid = UserHelper.GetUserId(HttpContext); long gid = GuideUserSvc.GetGid((long)userid); bool isok = UserSvc.UpdateUser((long)userid, model.nickname, model.phonenum, model.gender, model.password, model.email); if (gid == null) { if (isok) { return(Json(new AjaxResult { status = "ok" })); } return(Json(new AjaxResult { status = "error", errorMsg = "保存失败" })); } bool issuccess = GuideSvc.UpdateGuide(gid, model.school, model.intro); if (issuccess && isok) { return(Json(new AjaxResult { status = "ok" })); } return(Json(new AjaxResult { status = "error", errorMsg = "保存失败" })); }
/// <summary> /// 个人资料 /// </summary> /// <returns></returns> public ActionResult personinformation() { long userid = (long)UserHelper.GetUserId(HttpContext); var user = UserSvc.GetById(userid); personViewModel model = new personViewModel(); model.account = user.Account; model.phonenum = user.PhoneNum; model.nickname = user.NickName; model.gender = user.Gender; model.email = user.Email; long guideid = GuideUserSvc.GetGid(userid); var guide = GuideSvc.GetById(guideid); if (guide != null) { model.allschool = schoolSvc.GetAll(); model.school = guide.school; model.intro = guide.intro; } ViewBag.guideid = guide; ViewBag.phonenum = user.PhoneNum; return(View(model)); }