Example #1
0
        public async Task <IHttpActionResult> GetByIdAsync(int id)
        {
            CategoriesDTM category = await service.GetByIdAsync(id);

            if (category == null)
            {
                return(NotFound());
            }
            return(Ok(category));
        }
Example #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));
        }
Example #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));
        }
Example #4
0
 public async void UpdateAsync(CategoriesDTM categoriesDTM)
 {
     var categories = mapper.Map <Categories>(categoriesDTM);
     await Task.Run(() => uow.Categories.Update(categories));
 }