コード例 #1
0
        public ActionResult DenyFriendRequest(User receiver, string sender)
        {
            IDAL DAL = new DBDataAL();
            FriendRequest fr = DAL.GetFriendRequests(receiver).Where(r => r.Sender == sender).First();
            DAL.RemoveFriendRequest(fr);

            IEnumerable<FriendRequest> friends = DAL.GetFriendRequests(receiver);

            FriendData data = new FriendData("matt");
            return View("Web/Friends", data);
        }
コード例 #2
0
        public ActionResult DenyFriendRequest(string sender)
        {
            string currentUser = User.Identity.Name;

            IDAL DAL = new DBDataAL();
            User user = DAL.GetUser(currentUser);
            FriendRequest fr = DAL.GetFriendRequests(user).Where(r => r.Sender == sender).ToList().First();
            DAL.RemoveFriendRequest(fr);

            FriendData data = new FriendData(currentUser);
            return View("~/Views/Web/Friends.cshtml", data);
        }
コード例 #3
0
        public ActionResult AcceptFriendRequest(User receiver, string sender)
        {
            IDAL DAL = new DBDataAL();
            DAL.AddFriend(receiver.UserName, sender);

            IEnumerable<FriendRequest> requests = DAL.GetFriendRequests(receiver).Where(r => r.Sender == sender);
            IEnumerable<FriendRequest> requests2 = DAL.GetFriendRequests(DAL.GetUser(sender)).Where(r => r.Sender == receiver.UserName);
            IEnumerable<FriendRequest> fullList = requests.Concat(requests2);
            foreach (FriendRequest req in fullList)
            {
                DAL.RemoveFriendRequest(req);
            }

            IEnumerable<FriendRequest> friends = DAL.GetFriendRequests(receiver);

            FriendData data = new FriendData("matt");
            return View("Web/Friends", data);
        }
コード例 #4
0
        public ActionResult AcceptFriendRequest(string sender)
        {
            string currentUser = User.Identity.Name;
            IDAL DAL = new DBDataAL();

            User user = DAL.GetUser(currentUser);

            IEnumerable<string> friends = DAL.GetFriends(user).ToList();
            if(!friends.Contains(sender))
            {
                DAL.AddFriend(currentUser, sender);
            }

            IEnumerable<FriendRequest> requests = DAL.GetFriendRequests(user).Where(r => r.Sender == sender);
            IEnumerable<FriendRequest> requests2 = DAL.GetFriendRequests(DAL.GetUser(sender)).Where(r => r.Sender == currentUser);
            IEnumerable<FriendRequest> fullList = requests.Concat(requests2);
            foreach (FriendRequest req in fullList)
            {
                DAL.RemoveFriendRequest(req);
            }

            FriendData data = new FriendData(currentUser);
            return View("~/Views/Web/Friends.cshtml", data);
        }