Пример #1
0
        public async Task <IHttpActionResult> GetByIdAsync(int id)
        {
            CategoriesDTM category = await service.GetByIdAsync(id);

            if (category == null)
            {
                return(NotFound());
            }
            return(Ok(category));
        }
Пример #2
0
        public async Task <IHttpActionResult> GetSuppliersByCategoryAsync(int id)
        {
            CategoriesDTM category = await categoriesService.GetByIdAsync(id);

            if (category == null)
            {
                return(NotFound());
            }
            IEnumerable <SuppliersDTM> suppliers = await service.GetByCategoryAsync(id);

            if (suppliers == null)
            {
                return(NotFound());
            }
            return(Ok(suppliers));
        }
Пример #3
0
        public async Task <IHttpActionResult> GetProductsByCategoryIdAsync(int id)
        {
            CategoriesDTM category = await categoriesService.GetByIdAsync(id);

            if (category == null)
            {
                return(NotFound());
            }
            IEnumerable <ProductsDTM> result = service.GetByCategory(id);

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

            return(Ok(result));
        }
Пример #4
0
 public async void UpdateAsync(CategoriesDTM categoriesDTM)
 {
     var categories = mapper.Map <Categories>(categoriesDTM);
     await Task.Run(() => uow.Categories.Update(categories));
 }