public static User FindByUserName(this DBEntities DB, string userName) { User user = DB.Users.Where(u => u.UserName == userName).FirstOrDefault(); return(user); }
public static bool AlreadyLike(this DBEntities DB, int postId, int userId) { Like like = DB.Likes.Where(l => (l.UserId == userId) && (l.PostId == postId)).FirstOrDefault(); return(like != null); }
public static bool UserNameExist(this DBEntities DB, string userName) { User user = DB.Users.Where(u => u.UserName == userName).FirstOrDefault(); return(user != null); }