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); }
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); }
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); }
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); }