public static List <PollModel> GetAllPollModels() { var polls = Polls.GetAllPolls(); var pollModels = new List <PollModel>(); foreach (var p in polls) { pollModels.Add(Load(p.PollId)); } return(pollModels); }
public ActionResult Index() { using (var s = new MemoryStream()) { string xml; using (var w = new XmlTextWriter(s, Encoding.UTF8)) { w.Formatting = Formatting.Indented; w.Indentation = 2; w.IndentChar = ' '; w.WriteStartDocument(); w.WriteStartElement("urlset"); w.WriteAttributeString("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9"); this.AddUrl(w, "Home", "Index"); this.AddUrl(w, "Home", "ViewCrew"); this.AddUrl(w, "Home", "ViewSponsors"); this.AddUrl(w, "Home", "ViewNews"); this.AddUrl(w, "Stats", "Index"); this.AddUrl(w, "Stats", "Users"); this.AddUrl(w, "Stats", "Events"); this.AddUrl(w, "Polls", "Index"); foreach (var i in Polls.GetAllPolls()) { this.AddUrl(w, "Polls", "Details", i.PollId.ToString(), i.Title); } this.AddUrl(w, "Events", "Index"); foreach (var i in Events.GetAllEvents()) { this.AddUrl(w, "Events", "Details", i.EventID.ToString(), i.Title); foreach (var j in Events.GetEventTournaments(i.EventID)) { this.AddUrl(w, "Events", "ViewTournament", j.TournamentID.ToString(), j.Title); } } this.AddUrl(w, "Forums", "Index"); var groups = this.Forums.GetViewableForumGroups(null); var forums = this.Forums.GetViewableForums(null, groups); foreach (var i in forums) { this.AddUrl(w, "Forums", "ViewForum", i.Forum.ForumID.ToString(), i.Forum.Name); foreach (var j in this.Forums.GetForumViewableThreads(i.Forum.ForumID)) { this.AddUrl(w, "Forums", "ViewThread", j.ThreadID.ToString(), j.Title); } } foreach (var i in this.Users.GetAllUsers()) { this.AddUrl(w, "Account", "ViewProfile", i.UserID.ToString(), i.Username); } w.WriteEndElement(); w.WriteEndDocument(); w.Flush(); s.Seek(0, SeekOrigin.Begin); using (var sr = new StreamReader(s)) { xml = sr.ReadToEnd(); } } return(Content(xml, "text/xml")); } }