public ActionResult ApiIndex(string overrideAccept = null) { var getter = HttpRuntime.Cache.Get("FileGetter", GlobalHelper.CacheMinutes, () => new FileGetter(GlobalHelper.DataFolder)); var clans = getter.GetAllRecent(true).OrderByDescending(c => c.Top15Wn8).ToArray(); var clansPage = new ClansPage(clans); if (Request.AcceptTypes != null && Request.AcceptTypes.Contains("application/text") || overrideAccept == "application/text") { var sb = new StringBuilder(); sb.AppendLine( "ClanTag;Name;Country;Moment;Actives;ActiveBattles;ActiveWinRate;WN8a;WN8t15;WN8t7;Members;Battles;WinRate;WN8;IsOldData;IsObsolete"); foreach (var c in clans) { sb.AppendFormat(CultureInfo.CurrentCulture, "{0};{1};{2};{3:o};{4};{5};{6:r};{7:r};{8:r};{9:r};{10};{11};{12:r};{13:r};{14};{15}", c.ClanTag, c.Name, c.Country, c.Moment, c.Active, c.ActiveBattles, c.ActiveWinRate, c.ActiveWn8, c.Top15Wn8, c.Top7Wn8, c.Count, c.TotalBattles, c.TotalWinRate, c.TotalWn8, c.IsOldData, c.IsObsolete); sb.AppendLine(); } return(Content(sb.ToString(), "text/plain", Encoding.UTF8)); } var json = JsonConvert.SerializeObject(clansPage, Formatting.Indented); return(Content(json, "application/json", Encoding.UTF8)); }
public ActionResult Index() { var getter = HttpRuntime.Cache.Get("FileGetter", GlobalHelper.CacheMinutes, () => new FileGetter(GlobalHelper.DataFolder)); var clans = getter.GetAllRecent().ToArray(); var clansPage = new ClansPage(clans); return(View(clansPage)); }
public ActionResult Index(string countryFilter = null, bool invertCountryFilter = false, int minActiveSize = 7, int maxActiveSize = 200, int minWn8T15 = 900, string tournament = null) { var getter = HttpRuntime.Cache.Get("FileGetter", GlobalHelper.CacheMinutes, () => new FileGetter(GlobalHelper.DataFolder)); var clans = getter.GetAllRecent().OrderByDescending(c => c.Top15Wn8).ToArray(); var clansPage = new ClansPage(clans, countryFilter, invertCountryFilter, minActiveSize, maxActiveSize, minWn8T15); return(View(clansPage)); }
public ActionResult Tournament(string tournament, string countryFilter = null, int minActiveSize = 0, int maxActiveSize = 200, int minWn8T15 = 0) { var getter = HttpRuntime.Cache.Get("FileGetter", GlobalHelper.CacheMinutes, () => new FileGetter(GlobalHelper.DataFolder)); var clans = getter.GetAllRecent().OrderByDescending(c => c.Top15Wn8).ToArray(); var t = Wot.Tournament.Read(GlobalHelper.DataFolder, tournament); var tournamentClans = new HashSet <string>(t.Clans); clans = clans.Where(c => tournamentClans.Contains(c.ClanTag)).ToArray(); var clansPage = new ClansPage(clans, countryFilter, false, minActiveSize, maxActiveSize, minWn8T15) { Tournament = t }; return(View(clansPage)); }