/// <summary> /// 更新用户 /// </summary> /// <param name="model"></param> public Results Update(MemberShipsModel model) { using (var connection = GetConnection()) { try { connection.Open(); var result = connection.Update(new { NickName = model.NickName, Sex = model.Sex, BirthOn = model.BirthOn, Email = model.Email, Phone = model.Phone }, new { Id = model.Id }, OPIM_Common.TableName.MemberShips); return(new Results()); } catch (Exception ex) { return(new Results(ex.Message)); } } }
/// <summary> /// 创建新的用户 /// </summary> /// <param name="model"></param> public Results Create(MemberShipsModel model) { using (var connection = GetConnection()) { try { connection.Open(); var result = connection.Insert(new { Id = model.Id, Account = model.Account, Password = model.Password, CreateOn = model.CreateOn, LimitLevel = model.LimitLevel, NickName = model.NickName, //Sex = model.Sex, //BirthOn = model.BirthOn, //Icon = model.Icon }, OPIM_Common.TableName.MemberShips); return(new Results()); } catch (Exception ex) { return(new Results(ex.Message)); } } }
public Results ChangeInfomation(MemberShipsModel model) { if (model.Id == null || model.Id == Guid.Empty) { return(new Results("Id不能为空")); } return(_memberShipDapper.Update(model)); }
//[ValidateAntiForgeryToken] public ActionResult Register(RegisterModel registModel, CancellationToken token) { var memberShipModel = new MemberShipsModel(); memberShipModel.Id = Guid.NewGuid(); memberShipModel.Account = registModel.Account; memberShipModel.Password = registModel.Password; memberShipModel.NickName = registModel.NickName; memberShipModel.Phone = registModel.Phone; memberShipModel.Email = registModel.Email; memberShipModel.CreateOn = DateTime.Now; memberShipModel.BirthOn = DateTime.Now; memberShipModel.LimitLevel = (int)Permission.User; var session = Session["ValidateCode"].ToString().ToLower(); var result = _homeRespository.Register(registModel.Password, registModel.ConfirmPassword, registModel.VerificationCode, session, memberShipModel); return(Json(result)); }
public Results Register(string password, string rePassword, string vCode, string seesion, MemberShipsModel model) { if (StringHelper.IsNullOrEmptyOrWhiteSpace(model.Account) || StringHelper.IsNullOrEmptyOrWhiteSpace(password)) { return(new Results("帐号和密码不能为空")); } if (password != rePassword) { return(new Results("两次密码不一致")); } if (vCode == null || seesion == null || seesion != vCode.ToLower()) { return(new Results("验证码有误")); } model.Password = EncryptHelper.CreateHash(model.Password); return(_memberShipDapper.Create(model)); }
public ActionResult UpdateInformation(MemberShipsModel model) { var result = _memberShipsRespository.ChangeInfomation(model); return(Json(result)); }