예제 #1
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var data = await _productQueries.GetProducts();

                return(Ok(new ApiOkResponse(data, data.Count())));
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex, "Error on Get Customers");
                return(BadRequest(new ApiBadRequestResponse(500, "Something Wrong")));
            }
        }
예제 #2
0
 public IEnumerable <ProductModel> GetProducts()
 {
     _logger.LogDebug($"Request {nameof(GetProducts)}");
     return(_queries.GetProducts().Select(s => new ProductModel(s)));
 }