コード例 #1
0
ファイル: DataTest.cs プロジェクト: Profilan/APIWoood
        public void StructureList()
        {
            var rep = new StructureRepository();

            var structures = rep.List("MAINPROD_ASC");

            structures.Should().NotBeNull();
        }
コード例 #2
0
ファイル: DataTest.cs プロジェクト: Profilan/APIWoood
        public void StructureListByProduct()
        {
            var rep = new StructureRepository();

            var structures = rep.List("373666-E");

            structures.Should().NotBeNullOrEmpty();
        }
コード例 #3
0
        public IHttpActionResult GetStructureList(int page = 1, int limit = 25)
        {
            var products = new List <Dictionary <string, object> >();

            try
            {
                var pagedResult = structureRepository.List("MAINPROD_ASC", limit, page);

                int pageCount = 0;
                foreach (var item in pagedResult.Results)
                {
                    var product = GetItem(item.MAINPROD);
                    if (product != null)
                    {
                        products.Add(GetItem(item.MAINPROD));
                        ++pageCount;
                    }
                }

                var collection = new PagedCollection <Dictionary <string, object> >()
                {
                    _embedded   = products,
                    page_size   = pagedResult.PageSize,
                    page        = pagedResult.CurrentPage,
                    total_items = pagedResult.RowCount,
                    page_count  = pageCount
                };

                logger.Log(ErrorType.INFO, "GetStructureList(page = " + page + ", limit = " + limit + ")", RequestContext.Principal.Identity.Name, "Total in query: " + pageCount, "api/woood-structureview/list", startDate);

                return(Ok(collection));
            }
            catch (Exception e)
            {
                logger.Log(ErrorType.ERR, "GetStructureList(page = " + page + ", limit = " + limit + ")", RequestContext.Principal.Identity.Name, e.Message, "api/woood-structureview/list");

                return(InternalServerError(e));
            }
        }