public Storie StorieTop5() { Setup(); Random r = new Random(); List <Storie> top = stories.Where(s => s.Category.Contains("top")).ToList(); if (session.Top5.Count() >= 5) { session.Top5 = new List <string>(); } int count = 5; int showing = r.Next(0, count); bool ok; Storie s = top.ElementAt(showing); while (session.Top5.Contains(StringHelper.OnlyAlphanumeric(s.HeadLine, false, true, "", new char[0], out ok))) { showing = r.Next(0, count); s = top.ElementAt(showing); } List <string> top5 = session.Top5; top5.Add(StringHelper.OnlyAlphanumeric(s.HeadLine, false, true, "", new char[0], out ok)); session.Top5 = top5; s.Showing = showing + 1; s.Count = count; return(s); }
public Storie StorieFeature() { Setup(); Storie s = stories.Where(s => s.Category.Contains("feature")).FirstOrDefault(); s.Showing = 1; s.Count = 1; return(s); }
public Storie StorieRand() { Setup(); Random r = new Random(); int showing = r.Next(0, stories.Count()); int count = stories.Count(); Storie s = stories.ElementAt(showing); s.Showing = showing + 1; s.Count = count; return(s); }
public Storie StorieLove() { Setup(); Random r = new Random(); List <Storie> love = stories.Where(s => s.Category.Contains("love")).ToList(); int showing = r.Next(0, love.Count()); int count = love.Count(); Storie s = love.ElementAt(showing); s.Showing = showing + 1; s.Count = count; return(s); }