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/ACL.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Project-Unite/ACL.cs') diff --git a/Project-Unite/ACL.cs b/Project-Unite/ACL.cs index dc12487..73636c7 100644 --- a/Project-Unite/ACL.cs +++ b/Project-Unite/ACL.cs @@ -28,6 +28,13 @@ namespace Project_Unite return hpr.Raw(CommonMark.CommonMarkConverter.Convert(hpr.Encode(md))); } + public static bool IsFollowed(string you, string fId) + { + var db = new ApplicationDbContext(); + var uid = db.Users.FirstOrDefault(x => x.UserName == you).Id; + return db.Follows.FirstOrDefault(x => x.Follower == uid && x.Followed == fId) != null; + } + public static IHtmlString UserLink(this HtmlHelper hpr, string userId) { using(var db = new ApplicationDbContext()) -- cgit v1.2.3