Beispiel #1
0
 public CategoryController(
     GetAllCategoriesQuery getAllCategoriesQuery,
     GetProductsByCategoryQuery getProductsByCategoryQuery)
 {
     GetAllCategoriesQuery      = getAllCategoriesQuery;
     GetProductsByCategoryQuery = getProductsByCategoryQuery;
 }
Beispiel #2
0
        public async Task <IActionResult> GetProductsByCategory([FromQuery] GetProductsByCategoryQuery query)
        {
            var result = await _mediatr.Send(query);

            if (result is NotFoundResponse)
            {
                return(NotFound());
            }

            return(Ok(result));
        }