Ejemplo n.º 1
0
        public async Task <IActionResult> Profile(string SearchValue, string buttonType, int friendID,
                                                  ProfileSettingsViewModel profileSettingsModel, string settingsCall, string friendCall)
        {
            userId = Convert.ToInt16(CookieClaims.GetCookieID(User));
            List <User> _searchResult = null;

            try
            {
                //for add a friend on there profile page
                if (friendID != 0 && String.IsNullOrEmpty(buttonType))
                {
                    //third parameter is the actionId default it is 0
                    _friendLogic.SendFriendRequest(userId, friendID);
                    userId = friendID;
                }

                //update Profile/Account settings
                if (settingsCall == "True")
                {
                    if (!ModelState.IsValid)
                    {
                        return(PartialView(GetProfileModel()));
                    }

                    //Update User Account settings
                    await ProfileSettings(profileSettingsModel);
                }

                if (friendCall == "True" || !string.IsNullOrEmpty(SearchValue))
                {
                    _searchResult = ProfileFriends(buttonType, friendID, SearchValue);
                }

                //update the cookies

                return(PartialView(GetProfileModel(_searchResult)));
            }
            catch (ExceptionHandler exception)
            {
                ViewData[exception.Index] = exception.Message;
                return(PartialView(GetProfileModel()));
            }
        }
Ejemplo n.º 2
0
        public IActionResult TimeLine()
        {
            TimeLineViewModel timeLineView = new TimeLineViewModel();

            timeLineView.Posts = _postLogic.GetPosts(_friendLogic.GetFriendIds(Convert.ToInt16(CookieClaims.GetCookieID(User))));
            return(View(timeLineView));
        }
Ejemplo n.º 3
0
        public IActionResult Profile(int Id)
        {
            userId = (Id != 0)? Id : Convert.ToInt16(CookieClaims.GetCookieID(User));

            return(View(GetProfileModel()));
        }