示例#1
0
 /// <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));
         }
     }
 }
示例#2
0
 /// <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));
         }
     }
 }
示例#3
0
 public Results ChangeInfomation(MemberShipsModel model)
 {
     if (model.Id == null || model.Id == Guid.Empty)
     {
         return(new Results("Id不能为空"));
     }
     return(_memberShipDapper.Update(model));
 }
示例#4
0
        //[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));
        }
示例#5
0
 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));
 }
示例#6
0
        public ActionResult UpdateInformation(MemberShipsModel model)
        {
            var result = _memberShipsRespository.ChangeInfomation(model);

            return(Json(result));
        }