Ejemplo n.º 1
0
        public async Task <ActionResult <PublicApi.v1.DTO.InventoryWithProductCount> > GetInventory(int id)
        {
            var inventory = await _bll.Inventories.FindByShopAsyncAndIdAsync(id, User.GetShopId());

            if (inventory == null)
            {
                return(NotFound());
            }

            return(InventoryMapper.MapFromBLL(inventory));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.InventoryWithProductCount> > > GetInventory(string search, int?pageIndex, int?pageSize)
        {
            if ((pageIndex != null && pageIndex < 1) || (pageSize != null && pageSize < 1))
            {
                return(BadRequest());
            }
            var inventory = (await _bll.Inventories.GetByShopAsync(User.GetShopId(), search, pageIndex, pageSize)).Select(e => InventoryMapper.MapFromBLL(e)).ToList();

            return(inventory);
        }