Example #1
0
        public void DebtorList()
        {
            var rep = new DebtorRepository();

            var debtors = rep.List("DEBITEURNR_ASC");

            debtors.Results.Should().NotBeNullOrEmpty();
        }
Example #2
0
        public IHttpActionResult GetPagedDebtors(int limit, int page = 1)
        {
            try
            {
                var result = debtorRepository.List("DEBITEURNR_ASC", limit, page);

                if (result.Results.Count > 0)
                {
                    var debtors = new List <DebtorDto>();
                    foreach (var debtor in result.Results)
                    {
                        debtors.Add(NewDebtor(debtor));
                    }


                    var collection = new PagedCollection <DebtorDto>()
                    {
                        _embedded   = debtors,
                        page_size   = result.PageSize,
                        page        = result.CurrentPage,
                        total_items = result.RowCount,
                        page_count  = result.PageCount
                    };

                    logger.Log(ErrorType.INFO, "GetPagedDebtors()", RequestContext.Principal.Identity.Name, "Total in query: " + result.Results.Count, "api/woood-debtors/list", startDate);

                    return(Ok(collection));
                }
                else
                {
                    logger.Log(ErrorType.INFO, "GetPagedDebtors()", RequestContext.Principal.Identity.Name, "Total in query: " + result.Results.Count, "api/woood-debtors/list", startDate);

                    return(Ok(new List <string>()));
                }
            }
            catch (Exception e)
            {
                logger.Log(ErrorType.ERR, "GetPagedDebtors()", RequestContext.Principal.Identity.Name, e.Message, "api/woood-debtors/list");

                return(InternalServerError(e));
            }
        }
Example #3
0
        public void ListDebtors()
        {
            var rep = new DebtorRepository();

            var debtors = rep.List();
        }