public ActionResult DeleteFriendConfirmed(int id)
        {
            FriendRepository friendRepository = new FriendRepository();
            friendRepository.RemoveFriendship(CurrentAccountID, id);

            return RedirectToAction("Index", "Friend", new { id = CurrentAccountID });
        }
        public ActionResult AcceptFriendConfirmed(int id)
        {
            FriendRepository friendRepository = new FriendRepository();
            friendRepository.AcceptFriendshipRequest(CurrentAccountID, id);

            return RedirectToAction("Index", "Friend", new { id = CurrentAccountID });
        }
        public UserProfileModel GetUserProfileByAccountID(int accountID)
        {
            Account account = _db.Accounts.SingleOrDefault(x => x.AccountID == accountID);

            if (account == null)
            {
                return null;
            }

            UserInfoModel userInfo = new UserInfoModel
            {
                AccountID = account.AccountID,
                Username = account.Username,
                FirstName = account.FirstName,
                LastName = account.LastName,
                Email = account.Email,
                City = account.City,
                Country = account.Country,
                DateBirthday = account.DateBirthday.GetValueOrDefault()
            };

            UserProfileModel userProfile = new UserProfileModel
            {
                UserInfo = userInfo
            };

            FriendRepository fr = new FriendRepository();

            userProfile.Friendship = fr.GetAllFriendshipRecordByAccountID(accountID);

            return userProfile;
        }
        public UserProfileModel GetUserProfileByAccountID(int accountID)
        {
            Account account = _db.Accounts.SingleOrDefault(x => x.AccountID == accountID);

            if (account == null)
            {
                return(null);
            }

            UserInfoModel userInfo = new UserInfoModel
            {
                AccountID    = account.AccountID,
                Username     = account.Username,
                FirstName    = account.FirstName,
                LastName     = account.LastName,
                Email        = account.Email,
                City         = account.City,
                Country      = account.Country,
                DateBirthday = account.DateBirthday.GetValueOrDefault()
            };

            UserProfileModel userProfile = new UserProfileModel
            {
                UserInfo = userInfo
            };

            FriendRepository fr = new FriendRepository();

            userProfile.Friendship = fr.GetAllFriendshipRecordByAccountID(accountID);

            return(userProfile);
        }
        public ActionResult DeleteFriendConfirmed(int firstID, int secondID)
        {
            FriendRepository _friendRepository = new FriendRepository();

            _friendRepository.RemoveFriendship(firstID,secondID);

            return RedirectToAction("Friends");
        }
        public ActionResult Index(int id, string currentFilter, string searchString)
        {
            UserProfileRepository userprofileRepository = new UserProfileRepository();
            FriendRepository friendRepository = new FriendRepository();

            if (Request.HttpMethod == "GET")
            {
                searchString = currentFilter;
            }

            ViewData["CurrentFilter"] = searchString;
            ViewData["AccountID"] = CurrentAccountID;

            return View("Index", new UsersListModel
            {
                Friendship = friendRepository.GetAllFriendshipRecordByAccountID(id),
                Users = userprofileRepository.SearchAvailableFriendsForAccountID(id, searchString)
            });
        }
 public ViewResult DeleteFriend(int firstID, int secondID)
 {
     FriendRepository _friendRepository = new FriendRepository();
     return View(_friendRepository.GetFriendship(firstID, secondID));
 }
        public ViewResult Friends()
        {
            FriendRepository _friendRepository = new FriendRepository();

            return View(_friendRepository.GetAllFriendshipList());
        }