public JsonResult GetCustomerProfile(int customerId) { _customerProfileViewService.IncrementViewCount(customerId); var profile = _customerProfileService.GetByCustomerId(customerId); var customerProfile = new CustomerProfileModel() { CustomerId = customerId, Views = _customerProfileViewService.GetViewCount(customerId), FriendCount = _customerProfileService.GetFriendCount(customerId), IsSelf = _workContext.CurrentCustomer.Id == customerId, IsFriend = _mobSocialService.GetFriendRequestStatus(_workContext.CurrentCustomer.Id, customerId) == FriendStatus.Friends, FavoriteSongs = _customerFavoriteSongService.GetTop10(customerId) }; if (profile != null) { customerProfile.AboutMe = profile.AboutMe; customerProfile.Website = profile.Website; customerProfile.CreatedDate = profile.DateCreated; customerProfile.UpdatedDate = profile.DateUpdated; } return(Json(customerProfile)); }
// todo add security to pertinent actions //todo consolidate left profile actions into one view and action for performance public ActionResult AddFriendButton(int toCustomerId) { var model = new AddFriendButtonModel(); model.CustomerProfileId = toCustomerId; model.CurrentCustomerId = _workContext.CurrentCustomer.Id; FriendStatus friendStatus = _socialNetworkService.GetFriendRequestStatus(_workContext.CurrentCustomer.Id, toCustomerId); model.ShowAddFriendButton = friendStatus == FriendStatus.None; model.ShowFriendsButton = friendStatus == FriendStatus.Friends; model.ShowConfirmFriendButton = friendStatus == FriendStatus.NeedsConfirmed; model.ShowFriendRequestSent = friendStatus == FriendStatus.FriendRequestSent; return(View(MobSocialConstant.ViewsPath + "/mobSocial/_AddFriendButton.cshtml", model)); }