public CategoryController( GetAllCategoriesQuery getAllCategoriesQuery, GetProductsByCategoryQuery getProductsByCategoryQuery) { GetAllCategoriesQuery = getAllCategoriesQuery; GetProductsByCategoryQuery = getProductsByCategoryQuery; }
public async Task <IActionResult> GetProductsByCategory([FromQuery] GetProductsByCategoryQuery query) { var result = await _mediatr.Send(query); if (result is NotFoundResponse) { return(NotFound()); } return(Ok(result)); }