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())); } }
public IActionResult TimeLine() { TimeLineViewModel timeLineView = new TimeLineViewModel(); timeLineView.Posts = _postLogic.GetPosts(_friendLogic.GetFriendIds(Convert.ToInt16(CookieClaims.GetCookieID(User)))); return(View(timeLineView)); }
public IActionResult Profile(int Id) { userId = (Id != 0)? Id : Convert.ToInt16(CookieClaims.GetCookieID(User)); return(View(GetProfileModel())); }