search works now
This commit is contained in:
@@ -39,7 +39,7 @@ namespace OnePeek.Api
|
||||
IEnumerable<XElement> xel = XDocument.Parse(xml).Elements().First().Descendants();
|
||||
|
||||
// create metadatas
|
||||
StoreSearchResults result = Deserialize.Xml<StoreSearchResults>(xml);
|
||||
StoreSearchResults result = new StoreSearchResults();
|
||||
result.StoreType = store;
|
||||
result.StoreCultureType = storeCulture;
|
||||
result.Results = xel.Where(x => x.Name.LocalName == "entry").Select(x =>
|
||||
@@ -53,7 +53,7 @@ namespace OnePeek.Api
|
||||
rating = rating * 0.5f;
|
||||
}
|
||||
|
||||
return new AppMetadata()
|
||||
AppMetadata data = new AppMetadata()
|
||||
{
|
||||
Id = childs.Get("id").Split(':').Last(),
|
||||
Urn = childs.Get("id"),
|
||||
@@ -62,8 +62,18 @@ namespace OnePeek.Api
|
||||
{
|
||||
AverageRating = rating,
|
||||
RatingCount = Convert.ToInt32(childs.Get("userRatingCount"))
|
||||
},
|
||||
Images = new AppMetadataImages()
|
||||
{
|
||||
Logo = new AppImage()
|
||||
{
|
||||
Rotation = 0,
|
||||
Urn = childs.Get("image")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return data;
|
||||
});
|
||||
result.Count = result.Results.Count();
|
||||
|
||||
|
||||
@@ -5,21 +5,29 @@
|
||||
|
||||
@foreach (var result in Model.Results)
|
||||
{
|
||||
<div class="result">
|
||||
<img src="/api/image/@(result.Images.Logo.Id).jpg" alt="@result.Name" style="float: left;" />
|
||||
@result.Name<br />
|
||||
Rating: <mark>@result.Rating.AverageRating</mark> (out of @result.Rating.RatingCount)
|
||||
</div>
|
||||
<a href="/meta/?id=@result.Id" class="result">
|
||||
<img src="/api/image/@(result.Images.Logo.Id).jpg" alt="@result.Name" class="result-image" />
|
||||
<b>@result.Name</b><br />
|
||||
Rating: @result.Rating.AverageRating (out of @result.Rating.RatingCount)
|
||||
</a>
|
||||
<hr />
|
||||
}
|
||||
|
||||
<style>
|
||||
.result
|
||||
{
|
||||
display: block;
|
||||
color: black;
|
||||
padding: 1rem;
|
||||
}
|
||||
.result:nth-child(4n+1)
|
||||
{
|
||||
background: #f7f7f7;
|
||||
}
|
||||
.result-image
|
||||
{
|
||||
float: left;
|
||||
width: 50px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user