예제 #1
0
        public async Task <HttpResponseMessage> GetAccrualLoans()
        {
            AccrualLoanFilter filter = CurrentUser.UserData.UserType == Common.Enum.Enum.UserType.Membership ? new AccrualLoanFilter {
                MembershipId = CurrentUser.UserData.Id, Type = Common.Enum.Enum.AccrualLoanType.Invoice
            } : null;

            var result = _paymentSystemService.GetAccrualLoans(filter);

            return(await this.ReturnSuccessModel(result.Any()?result : new AccrualLoanModel[] { }));
        }
        public IEnumerable <AccrualLoanModel> GetAccrualLoans(AccrualLoanFilter filter)
        {
            var query = _accrualLoanRepository.GetAccrualLoans();

            query = filter != null && filter.MembershipId != Guid.Empty ? query.Where(m => m.MembershipId == filter.MembershipId) : query;

            query = filter != null && filter.Type.HasValue ? query.Where(m => m.Type == filter.Type.Value) : query;

            var mappedList = ObjectMapper.Mapper.Map <IEnumerable <AccrualLoanModel> >(query.ToList());

            return(mappedList);
        }