Skip to content

Commit

Permalink
Update NuGet Packagesupdates
Browse files Browse the repository at this point in the history
  • Loading branch information
markhazleton committed May 29, 2024
1 parent e5c1745 commit bb9ebe8
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 28 deletions.
29 changes: 20 additions & 9 deletions Yelp.Api.Domain/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,25 @@ public async Task<ReviewsResponse> GetReviewsAsync(string businessID,
string locale = null,

Check warning on line 113 in Yelp.Api.Domain/Client.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
CancellationToken ct = default)
{
ApplyAuthenticationHeaders();
var dic = new Dictionary<string, object>();
if (!string.IsNullOrEmpty(locale))
dic.Add("locale", locale);
string querystring = dic.ToQueryString();
return await this.GetAsync<ReviewsResponse>($"{API_VERSION}/businesses/{Uri.EscapeDataString(businessID)}/reviews{querystring}",
ct)
.ConfigureAwait(false);
try
{
ApplyAuthenticationHeaders();
var dic = new Dictionary<string, object>();
if (!string.IsNullOrEmpty(locale))
dic.Add("locale", locale);
string querystring = dic.ToQueryString();
return await this.GetAsync<ReviewsResponse>($"{API_VERSION}/businesses/{Uri.EscapeDataString(businessID)}/reviews{querystring}",
ct)
.ConfigureAwait(false);

}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return new ReviewsResponse();


}

/// <summary>
Expand All @@ -135,7 +146,7 @@ public async Task<SearchResponse> SearchBusinessesAllAsync(SearchRequest search,
if (search == null)
throw new ArgumentNullException(nameof(search));

ValidateCoordinates(search.Latitude, search.Longitude);
//ValidateCoordinates(search.Latitude, search.Longitude);
ApplyAuthenticationHeaders();

var querystring = search.GetChangedProperties().ToQueryString();
Expand Down
2 changes: 1 addition & 1 deletion Yelp.Api.Domain/Models/Location.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Location
public string Country { get; set; }

[JsonProperty("display_address")]
public string[] DisplayAddress { get; set; }
public string[] DisplayAddress { get; set; } = [];

[JsonProperty("state")]
public string State { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Yelp.Api.Domain/Models/ReviewsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class ReviewsResponse : ResponseBase
{
[JsonProperty("reviews")]
public Review[] Reviews { get; set; }
public Review[] Reviews { get; set; }= [];

[JsonProperty("total")]
public int Total { get; set; }
Expand Down
9 changes: 6 additions & 3 deletions Yelp.Api.Web/Views/Home/Category.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
@if (Model != null)
{
<div class="row">
@foreach (var item in Model.Businesses)
@if (Model.Businesses != null)
{
@await Html.PartialAsync("_businessResponse",item)
foreach (var item in Model.Businesses)
{
@await Html.PartialAsync("_businessResponse", item)
}
}
</div>
}
</div>

<div>
<small>@Model.City , @Model.State</small><br />
<small>@Model?.City , @Model?.State</small><br />
<small>Data from @Model.RequestTime.ToLongDateString() - @Model.RequestTime.ToLongTimeString()</small><br />
</div>
36 changes: 22 additions & 14 deletions Yelp.Api.Web/Views/Home/_businessResponse.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,34 @@

<div class="col-sm-6 col-lg-4 mb-5 hover-animate" data-marker-id="59c0c8e33b1527bfe2abaf92">
<div class="card h-100 border-0 shadow">
<div class="card-img-top overflow-hidden dark-overlay bg-cover" style="background-image: url(@Model.Photos.First()); min-height: 200px;">
</div>
@if (Model.Photos != null && Model.Photos.Any())
{
<div class="card-img-top overflow-hidden dark-overlay bg-cover" style="background-image: url(@Model.Photos.First()); min-height: 200px;">
</div>
}
<div class="card-header">
<h3 class="text-primary text-shadow"><a class="tile-link" target="_blank" href="@Model.Url">@Model.Name</a></h3>
<h3 class="text-primary text-shadow"><a class="tile-link" target="_blank" href="@Model?.Url">@Model?.Name</a></h3>
</div>
<div class="card-body">
@foreach(var loc in @Model.Location.DisplayAddress)
@foreach (var loc in @Model.Location.DisplayAddress)
{
@loc<br />
@loc

<br />
}
@Model.DisplayPhone<br/>
@Model.DisplayPhone<br />
<div class="container">
<strong>Reviews</strong>
<dl>
@foreach (var review in Model.Reviews)
{
<dt class="">@review.Rating</dt>
<dd class="">@review.Text</dd>
}
</dl>
@if (Model.Reviews != null && Model.Reviews.Any())
{
<strong>Reviews</strong>
<dl>
@foreach (var review in Model.Reviews)
{
<dt class="">@review.Rating</dt>
<dd class="">@review.Text</dd>
}
</dl>
}
</div>
</div>
</div>
Expand Down

0 comments on commit bb9ebe8

Please sign in to comment.