Advertisement
MrModest

Forum

Jun 17th, 2018
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.02 KB | None | 0 0
  1. public abstract class BaseEntity
  2. {
  3.     public int Id { get; set; }
  4. }
  5.  
  6. public class Forum : BaseEntity
  7. {
  8.     public string Name { get; set; } // movie, cartoon, book, comics, anime, manga, other
  9.     public string Description { get; set; }
  10.    
  11.     public virtual IEnumerable<Post> Posts { get; set; }
  12. }
  13.  
  14. public class Post : BaseEntity
  15. {
  16.     public int ForumId { get; set; }
  17.  
  18.     public int AuthorId { get; set; }
  19.     public virtual ApplicationUser Author { get; set; }
  20.  
  21.     public string Title { get; set; }
  22.     public string Text { get; set; }
  23.     public virtual IEnumerable<Attachment> Attachments { get; set; }
  24.  
  25.     public virtual IEnumerable<Comment> Comments { get; set; }
  26.  
  27.     public int Rating { get; set; } // haven't "-1"; can't be negative
  28.     public bool IsSolved { get; set; }
  29.  
  30.     public DateTime Created { get; set; }
  31.     public DateTime Updated { get; set; } // at first equal to 'Created'
  32.  
  33.     public bool Show { get; set; } // for moderate
  34. }
  35.  
  36. public class ApplicationUser : IdentityUser<int>
  37. {
  38.     public string Avatar { get; set; }
  39.     public string Cover { get; set; } // Background Image in user profile page
  40.     public int Karma { get; set; }
  41. }
  42.  
  43. public class Attachment : BaseEntity
  44. {
  45.     public AttachmentType Type { get; set; }
  46.     public string Link { get; set; }
  47. }
  48.  
  49. public enum AttachmentType
  50. {
  51.     Image,
  52.     Video,
  53.     Link
  54. }
  55.  
  56. public class Comment : BaseEntity
  57. {
  58.     public int PostId { get; set; } // owned post id
  59.     public int? ParentId { get; set; } // to whom the answer
  60.  
  61.     public int AuthorId { get; set; }
  62.     public virtual ApplicationUser Author { get; set; }
  63.  
  64.     public string Text { get; set; }
  65.     public virtual IEnumerable<Attachment> Attachments { get; set; }
  66.  
  67.     public int Rating { get; set; } //? "-1" divide by 2 when go to karma
  68.     public bool IsCorectAnswer { get; set; }
  69.  
  70.     public DateTime Created { get; set; }
  71.     public DateTime Updated { get; set; } // at first equal to 'Created'
  72.  
  73.     public bool Show { get; set; } // for moderate
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement