Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public enum ContentType
  2. {
  3. Text,
  4. Image,
  5. Video,
  6. Audio,
  7. }
  8.  
  9. public class Content
  10. {
  11. public int Id { get; set; }
  12. public ContentType { get; set; }
  13. }
  14.  
  15. public class TestContext : DbContext
  16. {
  17. public DbSet<Content> Contents { get; set; }
  18.  
  19. public static List<Content> GetImages()
  20. {
  21. using (var context = new TestContext()
  22. {
  23. return context.Contents
  24. .Where(c => c.ContentType == ContentType.Image)
  25. .ToList();
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement