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);
        }
 public IEnumerable<FriendRequest> GetFriendRequests(User user)
 {
     IEnumerable<FriendRequest> requests = null;
     using (TempDBFriendContext db = new TempDBFriendContext())
     {
         requests = db.FriendRequests.Where(x => x.Receiver.Equals(user.UserName)).ToList();
     }
     return requests;
 }
        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);
        }
Exemple #6
0
 public UserViewModel(User user)
 {
     this.User = user;
     this.Attack = user.Attack;
     //this.AttackRange = user.AttackRange;
     //this.AttackSpeed = user.AttackSpeed;
     this.CurrentHealth = user.CurrentHealth;
     this.Defense = user.Defense;
     this.MonstersKilled = user.HighMonstersKilled;
     //this.MoveSpeed = user.MoveSpeed;
     this.RoomsTraveled = user.HighRoomsTraveled;
     this.HighestAttackAchieved = user.HighAttack;
     this.HighestDefenseAchieved = user.HighDefense;
 }
        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 FriendData(User user)
 {
     Owner = user;
     SetUp();
 }
 public IEnumerable<Message> GetMessagesFor(User user)
 {
     IEnumerable<Message> messages = null;
     using (TempDBFriendContext db = new TempDBFriendContext())
     {
         messages = db.Messages.Where(x => x.Receiver.Equals(user.UserName)).ToList();
     }
     return messages;
 }
 public IEnumerable<string> GetFriends(User user)
 {
     IEnumerable<string> friends = null;
     using (TempDBFriendListContext db = new TempDBFriendListContext())
     {
         IEnumerable<string> temp = db.Friends.Where(x => x.User.Equals(user.UserName)).Select(x => x.Friend1).ToList();
         IEnumerable<string> temp2 = db.Friends.Where(x => x.Friend1.Equals(user.UserName)).Select(x => x.User).ToList();
         friends = temp.Union(temp2).ToList();
     }
     return friends;
 }
Exemple #11
0
 private void UpdateHighScores(User user)
 {
     if (user.Attack > user.HighAttack)
     {
         user.HighAttack = user.Attack;
     }
     if (user.Defense > user.HighDefense)
     {
         user.HighDefense = user.Defense;
     }
     if (user.RoomsTraveled > user.HighRoomsTraveled)
     {
         user.HighRoomsTraveled = user.RoomsTraveled;
     }
     if (user.MonstersKilled > user.HighMonstersKilled)
     {
         user.HighMonstersKilled = user.MonstersKilled;
     }
 }
 public ActionResult Search(User user, string name)
 {
     FriendData data = new FriendData("matt");
     data.SearchFor(name);
     return View("Web/Friends", data);
 }