public ActionResult RemoveFriend(User user, string friend)
        {
            IDAL DAL = new DBDataAL();
            DAL.RemoveFriend(user.UserName, friend);

            FriendData data = new FriendData("matt");
            return View("Web/Friends", data);
        }
        public ActionResult DeleteMessage(User user, Message message)
        {
            IDAL DAL = new DBDataAL();
            DAL.RemoveMessage(message);

            FriendData data = new FriendData("matt");
            return View("Web/Friends", data);
        }
示例#3
0
        public ActionResult DeleteMessage(int messageId)
        {
            IDAL DAL = new DBDataAL();
            string Name = User.Identity.Name;
            DAL.RemoveMessage(messageId);

            FriendData data = new FriendData(Name);
            return View("~/Views/Web/Friends.cshtml", data);
        }
        public ActionResult RequestFriend(User user, string name)
        {
            FriendRequest fr = new FriendRequest();
            fr.Receiver = name;
            fr.Sender = user.UserName;
            IDAL DAL = new DBDataAL();
            DAL.CreateFriendRequest(fr);

            FriendData data = new FriendData("matt");
            return View("Web/Friends", data);
        }
        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);
        }
示例#6
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);
        }
        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);
        }
示例#8
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);
        }
 public ActionResult Friends()
 {
     massey_effect_matthews_mages.Models.FriendData data = new FriendData("matt");
     return View(data);
 }
示例#10
0
        public ActionResult RequestFriend(string name)
        {
            string currentUser = User.Identity.Name;

            IDAL DAL = new DBDataAL();
            User user = DAL.GetUser(name);
            try
            {
                FriendRequest requests = DAL.GetFriendRequests(user).Where(x => x.Sender == currentUser).First();
            }
            catch(Exception) //if null catch explosion
            {
                FriendRequest fr = new FriendRequest();
                fr.Receiver = name;
                fr.Sender = currentUser;
                DAL.CreateFriendRequest(fr);
            }

            FriendData data = new FriendData(currentUser);

            return View("~/Views/Web/Friends.cshtml", data);
        }
示例#11
0
        public ActionResult RemoveFriend(string friend)
        {
            string Name = User.Identity.Name;

            IDAL DAL = new DBDataAL();
            DAL.RemoveFriend(Name, friend);

            FriendData data = new FriendData(Name);
            return View("~/Views/Web/Friends.cshtml", data);
        }
示例#12
0
        public ActionResult SendMessage(Message message)
        {
            IDAL DAL = new DBDataAL();
            DAL.CreateMessage(message);

            string Name = User.Identity.Name;
            FriendData data = new FriendData(Name);
            return View("~/Views/Web/Friends.cshtml", data);
        }
示例#13
0
        public ActionResult Search(string name)
        {
            string currentUser = User.Identity.Name;

            FriendData data = new FriendData(currentUser);
            data.SearchFor(name);

            return View("~/Views/Web/Friends.cshtml", data);
        }
示例#14
0
 public ActionResult Friends()
 {
     string currentUser = User.Identity.Name;
     FriendData data = new FriendData(currentUser);
     return View(data);
 }
        public ActionResult SendMessage(Message message)
        {
            IDAL DAL = new DBDataAL();
            message.TimeStamp = BitConverter.GetBytes(DateTime.Now.Ticks);
            DAL.CreateMessage(message);

            FriendData data = new FriendData("matt");
            return View("Web/Friends", data);
        }
 public ActionResult Search(User user, string name)
 {
     FriendData data = new FriendData("matt");
     data.SearchFor(name);
     return View("Web/Friends", data);
 }