Example #1
0
        /// <summary>
        /// Handels everything for the friends page
        /// </summary>
        /// <param name="ButtonType"></param>
        /// <param name="friendID"></param>
        /// <param name="SearchValue"></param>
        /// <returns></returns>
        public List <User> ProfileFriends(string ButtonType = null, int friendID = 0, string SearchValue = null)
        {
            if (!String.IsNullOrEmpty(ButtonType) && friendID != 0)
            {
                switch (ButtonType)
                {
                case "Accept":
                    _friendLogic.AcceptFriendRequest(userId, friendID);
                    break;

                case "Decline":
                    _friendLogic.DeclineFriendRequest(userId, friendID);
                    break;

                case "Block":
                    _friendLogic.BlockFriend(userId, friendID);
                    break;

                case "Unblock":
                    _friendLogic.UnblockFriend(userId, friendID);
                    break;

                case "Cancel":
                    _friendLogic.DeclineFriendRequest(userId, friendID);
                    break;

                case "Remove":
                    _friendLogic.RemoveFriend(userId, friendID);
                    break;

                case "Send":
                    _friendLogic.SendFriendRequest(userId, friendID);
                    break;

                case "RemoveOwn":
                    _friendLogic.RemoveFriend(userId, friendID);
                    //To change the friends view for the guestviewer
                    userId = friendID;
                    break;

                default:
                    ViewData["ErrorFriends"] = "Oops something when wrong with getting the friends information!";
                    break;
                }
            }

            //Checks if there is a search request
            if (!String.IsNullOrEmpty(SearchValue))
            {
                return(_friendLogic.GetSearchResult(userId, SearchValue));
            }

            //Return Default
            return(null);
        }