public async Task <bool> PushRecommendedQuestionsNotification( RecommendedQuestionNotification recommendedQuestionNotification) { Logger.LogInformation($"{nameof(NotificationsMessageService)}.{nameof(PushRecommendedQuestionsNotification)}.Start"); var info = await Db.UsersInfo.FindUserInfoAsync(recommendedQuestionNotification.NotifierId); if (info == null) { return(false); } var notification = new Notification { UserId = recommendedQuestionNotification.NotifierId, Login = info.FirstName + " " + info.LastName, SmallAvatarLink = MediaConverter.ToFullAvatarUrl(info.OriginalAvatarUrl, AvatarSizeType.Small), ActionType = ActionType.Follow, EmmiterId = recommendedQuestionNotification.QuestionId, ActionDate = recommendedQuestionNotification.RecommendedDate }; await PushNotification(recommendedQuestionNotification.UserToId, notification); Logger.LogInformation($"{nameof(NotificationsMessageService)}.{nameof(PushRecommendedQuestionsNotification)}.End"); return(true); }
public async Task <IActionResult> NotifyRecommendedQuestions([FromBody] RecommendedQuestionNotification notification) { if (!ModelState.IsValid) { return(new BadResponseResult(ModelState)); } await _notificationsMessageHandler.PushRecommendedQuestionsNotification(notification); return(new OkResponseResult()); }