public UserReport(string username, List <Suspension> suspensions) { Username = username; Suspensions = suspensions.Where(x => !x.InvalidSuspension && x.Audited).ToList(); // As these are only used internally, and for calculation of automated ban triggers, we cannot include system as a source! var allBannedTags = Suspensions.Where(x => x.SuspensionType == SuspensionType.Ban && x.SuspensionSource != SuspensionSource.System).SelectMany(x => x.Tags); foreach (var group in allBannedTags.GroupBy(x => x.TagId)) { var tag = group.FirstOrDefault(); if (tag != null) { BanTagCounts.Add(new TagCount(tag, group.Count())); } } // As these are only used internally, and for calculation of automated ban triggers, we cannot include system as a source! var allTimedoutTags = Suspensions.Where(x => x.SuspensionType == SuspensionType.Timeout && x.SuspensionSource != SuspensionSource.System).SelectMany(x => x.Tags); foreach (var group in allTimedoutTags.GroupBy(x => x.TagId)) { var tag = group.FirstOrDefault(); if (tag != null) { TimeoutTagCounts.Add(new TagCount(tag, group.Count())); } } }
public ActionResult ConfirmSuspension() { Suspensions susp = (Suspensions)TempData["suspension"]; TempData["suspension"] = susp; return(View(susp)); }
private async Task SuspensionsHub_SuspensionUpdated(object _, SuspensionUpdatedEventArgs args) { if (Suspensions.Any(x => x.SuspensionId == args.SuspensionId)) { var qParam = new QueryParam("suspensionId", args.SuspensionId.ToString()); var newSuspension = await apiGateway.Get <SuspensionModel>("suspensions", queryParams : qParam).ConfigureAwait(false); UpdateState(newSuspension); } }
public ActionResult ConfirmSuspension(FormCollection form) { Suspensions susp = (Suspensions)TempData["suspension"]; var cust = GetCustomer(); susp.CustomerId = cust.ID; db.Suspensions.Add(susp); db.SaveChanges(); return(RedirectToAction("Index")); }
//private async Task SuspensionsHub_OnNewSuspension(object _, NewSuspensionEventArgs args) //{ // var qParam = new QueryParam("suspensionId", args.SuspensionId.ToString()); // var newSuspension = await apiGateway.Get<SuspensionModel>("suspensions", queryParams: qParam).ConfigureAwait(false); // UpdateState(newSuspension); //} private void UpdateState(SuspensionModel model) { if (model == null) { return; } var existingValue = Suspensions.Find(x => x.SuspensionId == model.SuspensionId); Suspensions.Remove(existingValue); Suspensions.Add(model); NotifyStateChanged(); }
private async Task SuspensionsHub_SuspensionUpdated(object _, SuspensionUpdatedEventArgs args) { if (!string.Equals(CurrentlySelectedChannel, args.ChannelOfOrigin, StringComparison.OrdinalIgnoreCase)) { return; } var qParam = new QueryParam("suspensionId", args.SuspensionId.ToString()); var updatedSuspension = await apiGateway.Get <SuspensionModel>("suspensions", queryParams : qParam).ConfigureAwait(false); if (updatedSuspension == null) { return; } var existingSuspension = Suspensions.Find(x => x.SuspensionId == args.SuspensionId); Suspensions.Remove(existingSuspension); Suspensions.Add(updatedSuspension); NotifyStateChanged(); }
public ActionResult CreateSuspension(Suspensions susp) { TempData["suspension"] = susp; return(RedirectToAction("ConfirmSuspension")); }
public ActionResult CreateSuspension() { Suspensions susp = new Suspensions(); return(View(susp)); }