public Task <IUserModel> ExecuteAsync(IUserModel user)
        {
            if (user.IsValid())
            {
                return(this.userRepository.InsertOrUpdateASync(user));
            }

            throw new Exception("First name or last name cannot be empty");
        }
Ejemplo n.º 2
0
        public TokenRequestModel Post(UserRequestModel user)
        {
            if (user != null)
            {
                if (_user.IsValid(user.Name, user.Password))
                {
                    Random            random = new Random();
                    var               value  = random.Next(100, 1000);
                    TokenRequestModel token  = new TokenRequestModel {
                        Value = value.ToString(), Expiredate = DateTime.Now.AddHours(1)
                    };

                    _token.UpdateToken(value.ToString(), DateTime.Now.AddHours(1));

                    return(token);
                }
            }
            return(null);
        }