/// <summary> /// Получить список записей для ленты с листованием /// </summary> /// <param name="profileID"></param> /// <param name="page"></param> /// <param name="count"></param> /// <returns></returns> public IActionResult GetContents(int profileID, int page, int count) { var vm = new ProfileCardViewModel(); if (profileID > 0) { if (count < 1) { count = 20; } if (page < 1) { page = 1; } // Получить список контента (записей в ленту) var contentList = _contentRepository.GetContentList(profileID, page, count); // Получить последние комментарии для записей в ленту. List <Comment> contentCommentList = null; if (contentList != null && contentList.Count > 0) { contentCommentList = _contentRepository.GetLastContentCommentList(contentList.Select(u => u.ID).ToList()); vm.PrepareContentData(contentList, contentCommentList); int totalContentCount = _contentRepository.GetContentListTotalCount(profileID); vm.Pagination = new PaginationData(_localizationService, LinkBuilder.Profile.Card(profileID), Utils.RequestUtils.GetRequesValues(Request), page, count, totalContentCount); } } return(Json(new { vm.ContentList, vm.Pagination } )); }
/// <summary> /// Sends the latest emotion score to the server as a profile card, updating the emotion profile on the server. /// </summary> /// <returns>A Task object for this method is asynchronous.</returns> private async Task UpdateEmotion() { var emotions = eyes.GetEmotions(); if (emotions == null) { return; } var emotionScore = new ProfileCardViewModel { Anger = emotions.Anger * 100, Contempt = emotions.Contempt * 100, Disgust = emotions.Disgust * 100, Fear = emotions.Fear * 100, Happiness = emotions.Happiness * 100, Neutral = emotions.Neutral * 100, Sadness = emotions.Sadness * 100, Surprise = emotions.Surprise * 100 }; await GetClientForCurrentUser().UpdateProfileEmotions(emotionScore); }
public IHttpActionResult UpdateEmotion([FromBody] ProfileCardViewModel viewModel) { var emotionScores = Tracker.Current.Interaction.Profiles["Emotion"]; var scores = new Dictionary <string, float> { { "Anger", viewModel.Anger }, { "Contempt", viewModel.Contempt }, { "Disgust", viewModel.Disgust }, { "Fear", viewModel.Fear }, { "Happiness", viewModel.Happiness }, { "Neutral", viewModel.Neutral }, { "Sadness", viewModel.Sadness }, { "Surprise", viewModel.Surprise } }; emotionScores.Score(scores); contactProfileProvider.Flush(); var data = GetData(); return(new JsonResult <ExperienceData>(data, new JsonSerializerSettings(), Encoding.UTF8, this)); }
/// <summary> /// Update the profile emotion data on the server. /// </summary> /// <param name="vm">The ProfileCardViewModel object containing the emotion profile data.</param> /// <returns>The updated experience model returned by the server.</returns> public async Task <ExperienceModel> UpdateProfileEmotions(ProfileCardViewModel vm) { var reply = await connection.PostData <ExperienceModel>(vm, "api/Profile/UpdateEmotion"); return(reply); }