Exemplo n.º 1
0
        public async Task <List <PS_PaySubGroup_Dto> > GetAllBySearchAsync(PS_PaySubGroup_Search_Dto data)
        {
            try
            {
                List <PS_PaySubGroup_Dto> result = await Task.Run(() => Repository
                                                                  .Include(x => x.PayGroup)
                                                                  .Include(x => x.LegalEntity)
                                                                  .Include(x => x.Frequency)
                                                                  .Include(x => x.PayrollPeriod)
                                                                  .ThenInclude(x => x.PayPeriods)
                                                                  .Include(x => x.AllowedBanks)
                                                                  .Select(MapToGetListOutputDto).ToList());

                for (int i = 0; i < result.Count; i++)
                {
                    if (!CustomHelpers.CheckIfMatches(result[i], data))
                    {
                        result.Remove(result[i]);
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public async Task <List <PS_PaymentBankFile_Dto> > GetAllBySearchAsync(PS_PaymentBankFile_Dto data)
        {
            try
            {
                List <PS_PaymentBankFile_Dto> result = await Task.Run(() => Repository
                                                                      .Include(x => x.PaymentBanks)
                                                                      .Select(MapToGetListOutputDto).ToList());

                for (int i = 0; i < result.Count; i++)
                {
                    if (!CustomHelpers.CheckIfMatches(result[i], data))
                    {
                        result.Remove(result[i]);
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }