From 0b2469ee1c836c0022f1d10d24dbd0055011c43a Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 23 Mar 2017 21:50:48 -0400 Subject: Front-end for following/un-following --- Project-Unite/Models/IdentityModels.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Project-Unite/Models/IdentityModels.cs') 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 Follows { get; set; } public DbSet UserPosts { get; set; } public DbSet ForumPostEdits { get; set; } public DbSet Likes { get; set; } -- cgit v1.2.3