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