public async Task <ActionResult> GetCategory(int id) { var category = await _categoryServices.GetCategoryAsync(id).ConfigureAwait(false);// _context.Categories.FindAsync(id); if (category == null) { return(NotFound()); } return(Ok(category)); }
public async Task <IActionResult> GetByIdAsync(int id) { var category = await _categoryServices.GetCategoryAsync(id); if (category != null) { return(Ok(category)); } return(Ok()); }
public async Task <IActionResult> Get(Guid id) { try { var category = await _categoryServices.GetCategoryAsync(id); if (category is null) { return(BadRequest("Not found")); } return(Ok(category)); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(BadRequest()); } }