private IActionResult InterceptResponse() { var @return = new OccurrencesViewModel(_notificationContext.GetNotifications()); if (ExisteNotFound(@return)) { return(new NotFoundObjectResult(@return) { ContentTypes = { "application/problem+json" }, DeclaredType = typeof(OccurrencesViewModel) }); } else { return(new BadRequestObjectResult(@return) { ContentTypes = { "application/problem+json" }, DeclaredType = typeof(OccurrencesViewModel) }); } }
private bool ExisteNotFound(OccurrencesViewModel response) { return(response.Occurrences.Any(e => e.StatusCode == StatusCodes.Status404NotFound)); }