示例#1
0
        public async Task <IResult <HistoryModel> > History(FilterMovementModel filter)
        {
            try
            {
                var account = await _sharedService.AccountValidate(filter.Cpf, filter.Password);

                if (!account.Success)
                {
                    return(Result <HistoryModel> .BuildError(account.Messages).LoggerError());
                }

                var movements = await _movementRepository.GetAccountHistory(account.Model.Id, filter.StartDate, filter.EndDate);

                if (movements == null || !movements.Any())
                {
                    return(Result <HistoryModel> .BuildError("Você não possui movimentos na conta nesse período.").LoggerError());
                }

                return(Result <HistoryModel> .BuildSucess(BuildHistoryModel(account.Model, movements)));
            }
            catch (Exception error)
            {
                return(Result <HistoryModel> .BuildError("Erro ao obter histórico da conta, favor tente novamente!", error)
                       .LoggerError());
            }
        }
 public async Task <IResult <HistoryModel> > History(FilterMovementModel filter)
 {
     return(await _movementService.History(filter));
 }