From 3ca76a82ea99fa453f400aff26d95a6fd240f548 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 22 Jul 2016 12:02:42 +0200 Subject: [PATCH] =?UTF-8?q?impl=C3=A9mente=20une=20premi=C3=A8re=20vue=20d?= =?UTF-8?q?e=20confirmation=20de=20la=20commande?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yavsc/Controllers/CommandController.cs | 9 ++- .../Views/Command/CommandConfirmation.cshtml | 66 +++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 Yavsc/Views/Command/CommandConfirmation.cshtml diff --git a/Yavsc/Controllers/CommandController.cs b/Yavsc/Controllers/CommandController.cs index 7e926124..3a1e5883 100644 --- a/Yavsc/Controllers/CommandController.cs +++ b/Yavsc/Controllers/CommandController.cs @@ -152,12 +152,16 @@ namespace Yavsc.Controllers var regids = command.PerformerProfile.Performer .Devices.Select(d => d.GCMRegistrationId); var sregids = string.Join(",",regids); - _logger.LogWarning($"ApiKey: {_googleSettings.ApiKey} {sregids}"); + _logger.LogWarning($"ApiKey: {_googleSettings.ApiKey}"); + _logger.LogWarning($"RegIds: {sregids}"); grep = await _GCMSender.NotifyAsync(_googleSettings,regids,yaev); } // TODO setup a profile choice to allow notifications // both on mailbox and mobile // if (grep==null || grep.success<=0 || grep.failure>0) + ViewBag.GooglePayload=grep; + if (grep!=null) + _logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}"); await _emailSender.SendEmailAsync( _siteSettings, _smtpSettings, @@ -166,7 +170,8 @@ namespace Yavsc.Controllers $"{yaev.Description}\r\n-- \r\n{yaev.Comment}\r\n" ); } - return RedirectToAction("Index"); + ViewBag.GoogleSettings = _googleSettings; + return View("CommandConfirmation",command); } ViewBag.GoogleSettings = _googleSettings; return View(command); diff --git a/Yavsc/Views/Command/CommandConfirmation.cshtml b/Yavsc/Views/Command/CommandConfirmation.cshtml new file mode 100644 index 00000000..894ec51c --- /dev/null +++ b/Yavsc/Views/Command/CommandConfirmation.cshtml @@ -0,0 +1,66 @@ +@model BookQuery +@using Yavsc.Models.Google.Messaging +@{ + ViewData["Title"] = SR["Book "+Model.PerformerProfile.ActivityCode]; +} +@section header{ + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } + + + + +} +@section scripts{ + +} +

@ViewData["Title"]

+
+

@SR["Your book query"]

+
+ @Html.DisplayFor(m => m.EventDate) + @Html.DisplayFor(m => m.Location) +

@SR["Notifications sent to its devices"]

+
+ @if (ViewBag.GooglePayload !=null) + { + + @if (ViewBag.GooglePayload.results !=null) { + @:success: @ViewBag.GooglePayload.success + @:failure: @ViewBag.GooglePayload.failure +
+ + @foreach (MessageWithPayloadResponse.Result mr in ViewBag.GooglePayload.results) { + @:message_id: @mr.message_id + @:registration_id: @mr.registration_id + @:error: @mr.error +
+ } + } + } +
+ +