public ActionResult ChangePassword(MemberView model) { ViewBag.IsPostBack = true; if (ModelState.IsValid) { //验证码验证通过 } else { //验证码验证失败 //ModelState.AddModelError("", e.Message); ViewBag.Message = "验证码输入不正确"; return(View(model)); } if (!ChangePasswordValidate(model)) { return(View(model)); } OperationResult result = AccountSiteContract.ChangePassword(model.Id, model.NewPassword); if (result.ResultType == OperationResultType.Success) { TempData["Message"] = string.Format("密码修改成功。"); return(RedirectToAction("InfoPage")); } else { ViewBag.Message = result.Message; return(View(model)); } }
public ActionResult Register(MemberView model, string psnl, string ent) { ViewBag.IsPostBack = true; if (ModelState.IsValid) { //验证码验证通过 } else { //验证码验证失败 //ModelState.AddModelError("", e.Message); ViewBag.Message = "验证码输入不正确"; return(View(model)); } if (!string.IsNullOrEmpty(psnl)) { model.MemberType = MemberType.Personal; } else if (!string.IsNullOrEmpty(ent)) { model.MemberType = MemberType.Enterprise; } try { string province = Request.Form["hidn_province"].ToString(); string city = Request.Form["hidn_city"].ToString(); string town = Request.Form["hidn_town"].ToString(); string suffix = Request.Form["addr_suffix"].ToString(); model.Province = province; model.City = city; model.Town = town; model.AddrSuffix = suffix; if (!MemberUpdateValidate(model)) { return(View(model)); } OperationResult result = AccountSiteContract.Register(model); string msg = result.Message ?? result.ResultType.ToDescription(); if (result.ResultType == OperationResultType.Success) { TempData["Message"] = "注册成功。现在<a href='/Account/Login'>登录<a>"; return(RedirectToAction("InfoPage")); } //ModelState.AddModelError("", msg); ViewBag.Message = msg; return(View(model)); } catch (Exception e) { //ModelState.AddModelError("", e.Message); ViewBag.Message = e.Message; return(View(model)); } }
/// <summary> /// 免审核 /// </summary> /// <param name="memberid">用户Id</param> public JsonResult NoAudit(long memberid, int?noauditTimes) { if (memberid == 0) { return(Json(new { ErrorString = "用户Id不合法" }, JsonRequestBehavior.AllowGet)); } OperationResult result = AccountSiteContract.NoAudit(memberid, noauditTimes); if (result.ResultType == OperationResultType.Success) { return(Json(new { ErrorString = "" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ErrorString = result.Message }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 删除 /// </summary> /// <param name="memberid">用户Id</param> public JsonResult Delete(long memberid) { if (memberid == 0) { return(Json(new { ErrorString = "用户Id不合法" }, JsonRequestBehavior.AllowGet)); } OperationResult result = AccountSiteContract.Delete(memberid); if (result.ResultType == OperationResultType.Success) { return(Json(new { ErrorString = "" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ErrorString = result.Message }, JsonRequestBehavior.AllowGet)); } }