mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 03:11:48 -05:00
notify users when certain contest events happen
This commit is contained in:
parent
54f52b10a6
commit
a2eed3b184
1 changed files with 11 additions and 0 deletions
|
@ -111,6 +111,15 @@ public ActionResult SubmitEntry(SubmitContestEntryViewModel model)
|
|||
|
||||
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 @@ public ActionResult CreateContest(CreateContestViewModel model)
|
|||
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 });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue