public async Task<JsonResult> Forget(SignupViewModel model) { if(Session["SMSForgetCode"].ToString() != model.Code) { return Json(new JsonErrorObj("验证码不正确", "code")); } using(MrCyContext ctx = new MrCyContext()) { ClientInfo client = ctx.ClientInfo.Where(p => p.LoginName == model.Mobile).FirstOrDefault(); client.LoginPwd = model.Password; ctx.Entry(client).Property(p => p.LoginPwd).IsModified = true; await ctx.SaveChangesAsync(); return Json(new JsonSucceedObj()); } }
public async Task<JsonResult> Signup(SignupViewModel model) { if(Session["SMSCode"].ToString() != model.Code) { return Json(new JsonErrorObj("验证码不正确", "code")); } using(MrCyContext ctx = new MrCyContext()) { ClientInfo client = new ClientInfo() { ClientId = (DateTime.Now.Year%100).ToString() + model.Mobile, ClientName = model.Mobile, LoginName = model.Mobile, LoginPwd = model.Password }; ctx.ClientInfo.Add(client); await ctx.SaveChangesAsync(); FormSignin(client); return Json(new JsonSucceedObj()); } }