public async Task <ActionResult> Get() { var results = await _genreQueryService.GetAllGenres(); if (results == null || !results.Any()) { return(this.NotFound()); } return(Json(results)); }
public async Task <JsonResult> Get() { _logger.LogInformation("Get all genres"); try { var results = await _genreQueryService.GetAllGenres(); return(Json(results ?? null)); } catch (DbException ex) { Log.Logger.Error("Failed to get genres", ex); Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json("Error occurred finding Genres" + ex.Message)); } }