public ActionResult AllUsers(int? userId) { var currentUserFriends = db.Users.FirstOrDefault(x => x.Id == userId).Friends; var cookie = new BasicCookie(db.Users.FirstOrDefault(x => x.Id == userId)); cookie.SetUserList(db.Users.Distinct().ToList().Where(x => !currentUserFriends.Contains(x) && x.Id != userId).ToList()); return View(cookie); }
public ActionResult Index(int? userId) { var currentUserFriends = db.Users.Where(x => x.Id == userId) .Select(t => t.Friends).First().Distinct().ToList(); var cookie = new BasicCookie(db.Users.FirstOrDefault(x => x.Id == userId)); cookie.SetUserList(currentUserFriends); return View(cookie); }