public void SetPost(Post p) { post = p; IsMatch = post.Categories.Contains(category); foreach (var vm in Categories) vm.SetPost(p); }
public static Post RandomPost() { var p = new Post(); // Generate random date var start = new DateTime(2000, 1, 1); var range = (DateTime.Today - start).Days; p.Date = start.AddDays(rand.Next(range)); // Generate random text p.Text = Wordlist.Instance.Random(3); // Generate random value p.Value = rand.NextDouble() * 1000; return p; }
public bool IsMatch(Post post) { return Filters.All(pattern => pattern.IsMatch(post)); }