summaryrefslogtreecommitdiff
path: root/Project-Unite/Models/IdentityModels.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-23 21:50:48 -0400
committerMichael <[email protected]>2017-03-23 21:50:48 -0400
commit0b2469ee1c836c0022f1d10d24dbd0055011c43a (patch)
tree1fcfe2eaa8b87e18436da602f1faeb6487467062 /Project-Unite/Models/IdentityModels.cs
parent8d7350c24ac95eb325ce9c653c4cb7c99fbcdcae (diff)
downloadproject-unite-0b2469ee1c836c0022f1d10d24dbd0055011c43a.tar.gz
project-unite-0b2469ee1c836c0022f1d10d24dbd0055011c43a.tar.bz2
project-unite-0b2469ee1c836c0022f1d10d24dbd0055011c43a.zip
Front-end for following/un-following
Diffstat (limited to 'Project-Unite/Models/IdentityModels.cs')
-rw-r--r--Project-Unite/Models/IdentityModels.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs
index 8d368ed..83ea777 100644
--- a/Project-Unite/Models/IdentityModels.cs
+++ b/Project-Unite/Models/IdentityModels.cs
@@ -12,6 +12,13 @@ using Microsoft.AspNet.Identity.EntityFramework;
namespace Project_Unite.Models
{
+ public class UserFollow
+ {
+ public string Id { get; set; }
+ public string Follower { get; set; }
+ public string Followed { get; set; }
+ }
+
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
@@ -98,6 +105,24 @@ namespace Project_Unite.Models
return db.UserPosts.Where(x => x.UserId == this.Id).ToArray();
}
}
+
+ public UserFollow[] Followed
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+ return db.Follows.Where(x => x.Follower == this.Id).ToArray();
+ }
+ }
+
+ public UserFollow[] Followers
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+ return db.Follows.Where(x => x.Followed == this.Id).ToArray();
+ }
+ }
}
public class BannedIP
@@ -124,6 +149,7 @@ namespace Project_Unite.Models
return new ApplicationDbContext();
}
+ public DbSet<UserFollow> Follows { get; set; }
public DbSet<UserPost> UserPosts { get; set; }
public DbSet<ForumPostEdit> ForumPostEdits { get; set; }
public DbSet<Like> Likes { get; set; }