From 05465c304b6e5ccb2583a1e5bb8937528f92c967 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Tue, 7 Feb 2017 00:12:57 +0100 Subject: [PATCH 1/2] Fixes a case --- Yavsc/ApiControllers/GCMController.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Yavsc/ApiControllers/GCMController.cs b/Yavsc/ApiControllers/GCMController.cs index 6ccfdee0..94a4c6ec 100644 --- a/Yavsc/ApiControllers/GCMController.cs +++ b/Yavsc/ApiControllers/GCMController.cs @@ -56,17 +56,13 @@ public class GCMController : Controller _context.GCMDevices.Add(declaration); _context.SaveChanges(); } - if (declaration.LatestActivityUpdate > default(DateTime)) - { - var latestActivityUpdate = _context.Activities.Aggregate( - (a,b)=>a.DateModified>b.DateModified?a:b - ).DateModified; - return Json(new { - IsAnUpdate = deviceAlreadyRegistered, - UpdateActivities = latestActivityUpdate>declaration.LatestActivityUpdate?true:false - }); - } - return Json(new { IsAnUpdate = deviceAlreadyRegistered }); + var latestActivityUpdate = _context.Activities.Aggregate( + (a,b)=>a.DateModified>b.DateModified?a:b + ).DateModified; + return Json(new { + IsAnUpdate = deviceAlreadyRegistered, + UpdateActivities = latestActivityUpdate>declaration.LatestActivityUpdate + }); } return new BadRequestObjectResult(ModelState); } From c85da9746e060197e85d4a684732346a13bee622 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Tue, 7 Feb 2017 00:13:10 +0100 Subject: [PATCH 2/2] prettier --- Yavsc/Controllers/BlogspotController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Yavsc/Controllers/BlogspotController.cs b/Yavsc/Controllers/BlogspotController.cs index 7631d66f..b25504f0 100644 --- a/Yavsc/Controllers/BlogspotController.cs +++ b/Yavsc/Controllers/BlogspotController.cs @@ -192,10 +192,11 @@ namespace Yavsc.Controllers _context.SaveChanges(); ViewData["StatusMessage"] = "Post modified"; return RedirectToAction("Index"); - } // TODO Else hit me hard + } else { - ViewData["StatusMessage"] = "Access denied ..."; + ViewData["StatusMessage"] = "Accès restreint"; + return new ChallengeResult(); } } return View(blog);