コード例 #1
0
        public async Task <bool> ChangePassword(ChangePasswordViewModel model)
        {
            var exitAccount = await AccountDb.AsQueryable().SingleAsync(a => a.Id == model.UserId.ToGuid() && a.Password == model.OldPassword.ToMD5());

            if (!exitAccount.IsNull())
            {
                exitAccount.ChangePassword(model.NewPassword.ToMD5());
                return(AccountDb.Update(exitAccount));
            }

            return(false);
        }
コード例 #2
0
        public async Task <bool> SignUp(Account model)
        {
            // implement sign up logic here

            var result = false;

            if (model.IsValidate)
            {
                var exitAccount = AccountDb.AsQueryable().FirstAsync(a => a.Name == model.Name);
                if (!exitAccount.IsNull())
                {
                    result = false;
                }
                else
                {
                    result = await AccountDb.AsInsertable(model).ExecuteCommandAsync() > 0;
                }
            }

            return(result);
        }