public static List <GetUsers> GetNotFollowin(int id) { Livingstone db = new Livingstone(); var followers = db.Followings.Where(x => x.UserID == id).ToList(); var userlist = new List <GetUsers>(); foreach (var item in db.Users) { if (followers.Any(x => x.FollowingID == item.Id)) { //Followers } else { if (item.ProfilePhotoes.FirstOrDefault().Photo == null) { userlist.Add(new GetUsers() { Id = item.Id, Name = item.Name, Surname = item.Surname, Photo = "noImage.png", Email = item.Email, RegNumber = item.RegNumber, CreateDate = item.CreateDate }); } else { userlist.Add(new GetUsers() { Id = item.Id, Name = item.Name, Surname = item.Surname, Photo = item.ProfilePhotoes.FirstOrDefault().Photo, Email = item.Email, RegNumber = item.RegNumber, CreateDate = item.CreateDate }); } } } userlist.Remove(userlist.Where(x => x.Id == id).FirstOrDefault()); return(userlist); }
public static List <Comment> Comments(int id) { Livingstone db = new Livingstone(); var commentlist = new List <Comment>(); foreach (var item in db.Comments.Where(x => x.UserID == id)) { commentlist.Add(new Comment() { CommentId = item.CommentId, UserID = item.UserID, CommentText = item.CommentText, CommentDate = item.CommentDate }); } foreach (var item in db.Replies.Where(x => x.UserID == id)) { } return(commentlist); }