Beispiel #1
0
        public async Task <DTO.Account> Save(DTO.Account account)
        {
            account.Valid();

            var result = await accountService.Save(new DO.Account(account));

            account = new DTO.Account(result);

            return(account);
        }
Beispiel #2
0
        public async Task <DTO.Account> GetLogin(DTO.Account account)
        {
            var result = await accountRepository.GetLogin(new DO.Account(account));

            if (result.IsNull())
            {
                throw new ArgumentException($"Usuário não encontrada.");
            }

            if (result.Login.IsNullOrWhiteSpace() || result.Password.IsNullOrWhiteSpace())
            {
                throw new ArgumentException($"Usuário não tem permissão.");
            }

            return(account.Password == result.Password ? new DTO.Account(result) : null);
        }