Пример #1
0
        public IActionResult ChangeStatus(string userId, int meetingId, InvitationStatus status)
        {
            _invitedUserRepository.ChangeStatus(userId, meetingId, status);

            var appLink = Url.Action(nameof(List), "InvitedUser", new { id = meetingId }, HttpContext.Request.Scheme);
            var meeting = _meetingRepository.GetMeeting(meetingId);
            var user    = _userManager.FindByIdAsync(userId).Result;
            var content = $"meeting: {meeting.Title}, new status: {status} changed by the user: {user.FullName}";
            var users   = _invitedUserRepository.GetUsersEmailsForNotification(meetingId,
                                                                               _userManager.FindByIdAsync(userId).Result.Id);

            foreach (var email in users)
            {
                _templateSender.SendGeneralEmailAsync(new SendEmailDetails
                {
                    IsHTML  = true,
                    ToEmail = email,
                    Subject = Constants.SubjectNewStatusInvitationEmail
                }, Constants.TitleNewStatusInvitationEmail,
                                                      $"{Constants.ContentNewStatusInvitationEmail}: {content}",
                                                      Constants.ButtonCheckMeeting,
                                                      appLink)
                .ContinueWith(t =>
                {
                    if (t.Result.Successful)
                    {
                        return;
                    }
                    foreach (var error in t.Result.Errors)
                    {
                        _logger.LogError(error);
                    }
                }, TaskScheduler.Default);
            }

            TempData["SuccessMessage"] = Constants.GeneralSuccessMessage;
            return(RedirectToAction(nameof(List), new { id = meetingId }));
        }
Пример #2
0
 public IActionResult ChangeStatus(string userId, int meetingId, InvitationStatus status)
 {
     _invitedUserRepository.ChangeStatus(userId, meetingId, status);
     TempData["SuccessMessage"] = Constants.GeneralSuccessMessage;
     return(RedirectToAction(nameof(List), new { id = meetingId }));
 }