public ActionResult Manage() { var bans = _bansGetter.Get("ns2").OrderByDescending(x => x.LastModified); var viewModel = bans.Select(_banAdapter.Adapt); return(View(viewModel)); }
public JsonResult IsBanned() { var bans = _bansGetter.Get("ns2"); var isBanned = bans.Any(x => x.PlayerId == PlayerId); var result = Json(isBanned, JsonRequestBehavior.AllowGet); return(result); }
protected override string GetResponseJson(string realmName, HttpRequest request, MySqlConnection connection) { var bans = _bansGetter.Get(realmName); var banDatas = new Dictionary <string, Dictionary <string, object> >(); foreach (var ban in bans) { var banData = new Dictionary <string, object>(); banData["UnbanTime"] = ban.UnbanTime; banData["Name"] = ban.PlayerName; banData["BannedBy"] = ban.CreatorName; banData["Duration"] = ban.DurationInSeconds; banData["Reason"] = ban.Reason; var banPlayerId = ban.PlayerId; banDatas.Add(banPlayerId.ToString(CultureInfo.InvariantCulture), banData); } var banned = new Dictionary <string, Dictionary <string, Dictionary <string, object> > > { { "Banned", banDatas } }; var result = JsonConvert.SerializeObject(banned); return(result); }