summaryrefslogtreecommitdiff
path: root/Project-Unite/Models/IdentityModels.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-23 18:08:20 -0400
committerMichael <[email protected]>2017-03-23 18:08:20 -0400
commit0f2629f0603b3c8f5dddf0747da6916dbf479dc4 (patch)
tree277a286b77ccaead5bd8f948f4eca9c0239ecabb /Project-Unite/Models/IdentityModels.cs
parent8330fbc5cb51d359d3716c431d1b4af0d31d4e2c (diff)
downloadproject-unite-0f2629f0603b3c8f5dddf0747da6916dbf479dc4.tar.gz
project-unite-0f2629f0603b3c8f5dddf0747da6916dbf479dc4.tar.bz2
project-unite-0f2629f0603b3c8f5dddf0747da6916dbf479dc4.zip
Profile work.
Diffstat (limited to 'Project-Unite/Models/IdentityModels.cs')
-rw-r--r--Project-Unite/Models/IdentityModels.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs
index 1cf9577..71b12b9 100644
--- a/Project-Unite/Models/IdentityModels.cs
+++ b/Project-Unite/Models/IdentityModels.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
@@ -131,4 +132,34 @@ namespace Project_Unite.Models
public DbSet<ForumPost> ForumPosts { get; set; }
}
+
+ public class UserPost
+ {
+ public string Id { get; set; }
+ public string UserId { get; set; }
+
+ [MaxLength(1000, ErrorMessage ="Your post can't have more than 1000 characters.")]
+ [AllowHtml]
+ [MinLength(20, ErrorMessage ="To prevent spam, you must have at least 20 characters in your post.")]
+ public string PostContents { get; set; }
+
+ public DateTime PostedAt { get; set; }
+
+ public Like[] Likes
+ {
+ get
+ {
+ return new ApplicationDbContext().Likes.Where(l => l.Topic == this.Id).Where(x => x.IsDislike == false).ToArray();
+ }
+ }
+
+ public Like[] Dislikes
+ {
+ get
+ {
+ return new ApplicationDbContext().Likes.Where(l => l.Topic == this.Id).Where(x => x.IsDislike == true).ToArray();
+ }
+ }
+
+ }
} \ No newline at end of file