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