Esempio n. 1
0
        public async Task <ActionResult <long> > CountItem([FromBody] Company_ItemFilterDTO Company_ItemFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }
            ItemFilter ItemFilter = new ItemFilter();

            ItemFilter.Id                = Company_ItemFilterDTO.Id;
            ItemFilter.ProductId         = Company_ItemFilterDTO.ProductId;
            ItemFilter.ProductTypeId     = Company_ItemFilterDTO.ProductTypeId;
            ItemFilter.ProductGroupingId = Company_ItemFilterDTO.ProductGroupingId;
            ItemFilter.Code              = Company_ItemFilterDTO.Code;
            ItemFilter.Name              = Company_ItemFilterDTO.Name;
            ItemFilter.ScanCode          = Company_ItemFilterDTO.ScanCode;
            ItemFilter.OtherName         = Company_ItemFilterDTO.OtherName;
            ItemFilter.SalePrice         = Company_ItemFilterDTO.SalePrice;
            ItemFilter.RetailPrice       = Company_ItemFilterDTO.RetailPrice;
            ItemFilter.Search            = Company_ItemFilterDTO.Search;
            ItemFilter.StatusId          = new IdFilter {
                Equal = StatusEnum.ACTIVE.Id
            };

            return(await ItemService.Count(ItemFilter));
        }
Esempio n. 2
0
        public async Task <ActionResult <List <Company_ItemDTO> > > ListItem([FromBody] Company_ItemFilterDTO Company_ItemFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }
            ItemFilter ItemFilter = new ItemFilter();

            ItemFilter.Skip              = Company_ItemFilterDTO.Skip;
            ItemFilter.Take              = Company_ItemFilterDTO.Take;
            ItemFilter.OrderBy           = ItemOrder.Id;
            ItemFilter.OrderType         = OrderType.ASC;
            ItemFilter.Selects           = ItemSelect.ALL;
            ItemFilter.Id                = Company_ItemFilterDTO.Id;
            ItemFilter.ProductId         = Company_ItemFilterDTO.ProductId;
            ItemFilter.ProductTypeId     = Company_ItemFilterDTO.ProductTypeId;
            ItemFilter.ProductGroupingId = Company_ItemFilterDTO.ProductGroupingId;
            ItemFilter.Code              = Company_ItemFilterDTO.Code;
            ItemFilter.Name              = Company_ItemFilterDTO.Name;
            ItemFilter.ScanCode          = Company_ItemFilterDTO.ScanCode;
            ItemFilter.OtherName         = Company_ItemFilterDTO.OtherName;
            ItemFilter.SalePrice         = Company_ItemFilterDTO.SalePrice;
            ItemFilter.RetailPrice       = Company_ItemFilterDTO.RetailPrice;
            ItemFilter.Search            = Company_ItemFilterDTO.Search;
            ItemFilter.StatusId          = new IdFilter {
                Equal = StatusEnum.ACTIVE.Id
            };

            List <Item> Items = await ItemService.List(ItemFilter);

            List <Company_ItemDTO> Company_ItemDTOs = Items
                                                      .Select(x => new Company_ItemDTO(x)).ToList();

            return(Company_ItemDTOs);
        }