public async Task <IActionResult> FetchQueriedVenues([FromRoute(Name = "query")] string query, [FromQuery(Name = "page")] int page = 0, [FromQuery(Name = "count")] int count = 20, [FromQuery(Name = "includeDetails")] bool includeDetails = true) { return(await(includeDetails ? venues.FetchQueriedVenues(query, page, count) : venues.FetchSimpleQueriedVenues(query, page, count)) .Ensure(v => v.HasValue, "Venues were found") .OnBoth(v => v.IsFailure ? StatusCode(404, "") : StatusCode(200, v.Value.Value)) .ConfigureAwait(false)); }