diff options
Diffstat (limited to 'Project-Unite/Controllers/ContestsController.cs')
| -rw-r--r-- | Project-Unite/Controllers/ContestsController.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Project-Unite/Controllers/ContestsController.cs b/Project-Unite/Controllers/ContestsController.cs index b4315d3..8cdb229 100644 --- a/Project-Unite/Controllers/ContestsController.cs +++ b/Project-Unite/Controllers/ContestsController.cs @@ -111,6 +111,15 @@ namespace Project_Unite.Controllers db.ContestEntries.Add(entry); db.SaveChanges(); + + foreach(var user in db.Users.ToArray()) + { + if (user.HighestRole.IsAdmin) + { + NotificationDaemon.NotifyUser(entry.AuthorId, user.Id, "New contest entry!", "A new entry has been submitted to the \"" + db.Contests.FirstOrDefault(x=>x.Id==entry.ContestId).Name + "\" contest.", Url.Action("ViewSubmission", "Contests", new { id = entry.Id })); + } + } + return RedirectToAction("ViewSubmission", "Contests", new { id = entry.Id }); } @@ -152,6 +161,8 @@ namespace Project_Unite.Controllers db.Contests.Add(c); db.SaveChanges(); + NotificationDaemon.NotifyEveryone(User.Identity.GetUserId(), "A contest has just started.", "A new contest has been open! Contest: " + c.Name, Url.Action("ViewContest", new { id = c.Id })); + return RedirectToAction("ViewContest", new { id = c.Id }); } } |
