public async Task <ActionResult <IEnumerable <Category> > > GetCategories() { var spec = new CategoriesOrderedByNameSpecification(); var categories = await _categoryRepository.ListAsync(spec); return(Ok(categories)); }
public async Task <ActionResult> GetCategoryById(int id) { var spec = new CategoriesOrderedByNameSpecification(id); var category = await _categoryRepository.GetEntityWithSpec(spec); if (category == null) { return(NotFound(new ApiResponse(404))); } return(Ok(category)); }