diff --git a/src/OnePeek.WebConsole/Modules/ApiModule.cs b/src/OnePeek.WebConsole/Modules/ApiModule.cs index f1f68e8..edde6a6 100644 --- a/src/OnePeek.WebConsole/Modules/ApiModule.cs +++ b/src/OnePeek.WebConsole/Modules/ApiModule.cs @@ -1,6 +1,7 @@ using Nancy; using OnePeek.Api; using OnePeek.Entities; +using System.Collections.Generic; using System.IO; namespace OnePeek.WebConsole.Modules @@ -26,6 +27,13 @@ namespace OnePeek.WebConsole.Modules }; + Get["/ratings/{id}", true] = async (ctx, token) => + { + IEnumerable ratings = await metaEndpoint.GetRatingsForAllCultures(ctx.id, StoreType.WindowsPhone8, new System.Threading.CancellationTokenSource().Token, null); + return Response.AsJson(ratings); + }; + + Get["/image/{id}.jpg", true] = async (ctx, token) => { Stream imageStream = await metaEndpoint.GetImageAsStream(ctx.id, StoreImageType.None); diff --git a/src/OnePeek.WebConsole/Modules/HomeModule.cs b/src/OnePeek.WebConsole/Modules/HomeModule.cs index e49a6e3..b03ac4f 100644 --- a/src/OnePeek.WebConsole/Modules/HomeModule.cs +++ b/src/OnePeek.WebConsole/Modules/HomeModule.cs @@ -1,6 +1,7 @@ using Nancy; using OnePeek.Api; using OnePeek.Entities; +using System.Collections.Generic; using System.IO; namespace OnePeek.WebConsole.Modules @@ -30,6 +31,12 @@ namespace OnePeek.WebConsole.Modules AppReviews reviews = await ratingEndpoint.GetReviews(Request.Query["id"], StoreType.WindowsPhone8, StoreCultureType.EN_US, StoreReviewSorting.Latest, Request.Query["prev"], Request.Query["next"]); return View["Reviews", reviews]; }; + + Get["/ratings", true] = async (ctx, token) => + { + IEnumerable ratings = await metaEndpoint.GetRatingsForAllCultures(Request.Query["id"], StoreType.WindowsPhone8, new System.Threading.CancellationTokenSource().Token, null); + return View["Ratings", new { Ratings = ratings }]; + }; } } } \ No newline at end of file diff --git a/src/OnePeek.WebConsole/OnePeek.WebConsole.csproj b/src/OnePeek.WebConsole/OnePeek.WebConsole.csproj index 467a3b3..cda1862 100644 --- a/src/OnePeek.WebConsole/OnePeek.WebConsole.csproj +++ b/src/OnePeek.WebConsole/OnePeek.WebConsole.csproj @@ -79,6 +79,7 @@ + Web.config diff --git a/src/OnePeek.WebConsole/Views/Index.cshtml b/src/OnePeek.WebConsole/Views/Index.cshtml index 44de15f..6eef642 100644 --- a/src/OnePeek.WebConsole/Views/Index.cshtml +++ b/src/OnePeek.WebConsole/Views/Index.cshtml @@ -15,4 +15,12 @@

REVIEWS

+ + +

+ +
+

RATINGS

+ +
\ No newline at end of file diff --git a/src/OnePeek.WebConsole/Views/Ratings.cshtml b/src/OnePeek.WebConsole/Views/Ratings.cshtml new file mode 100644 index 0000000..5542a22 --- /dev/null +++ b/src/OnePeek.WebConsole/Views/Ratings.cshtml @@ -0,0 +1,19 @@ +@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase +@{ + Layout = "_Layout.cshtml"; +} + +@foreach (var rating in Model.Ratings) +{ +
+

@rating.Culture

+

@rating.AverageRating (@rating.RatingCount)

+
+
+} + + \ No newline at end of file