Beispiel #1
0
        public async Task <IActionResult> Send(MailCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                Mail mail = new Mail()
                {
                    Subject = model.Subject,
                    Body    = model.Body
                };
                await _mailService.SendAsync(mail);

                AlertSuccess = $"Mail \"<strong>{mail.Subject}</strong>\" sent";
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(model));
            }
        }
        public async Task <IActionResult> Send(MailCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var mail = new Mail
                {
                    Subject = model.Subject,
                    Body    = model.Body
                };
                await _mailService.SendAsync(mail);

                AlertSuccess = _sharedLocalizer[Annotations.Interface.MailSent, mail.Subject];
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(model));
            }
        }
Beispiel #3
0
        public async Task <IActionResult> Reply(int id)
        {
            try
            {
                var mail = await _mailService.GetParticipantMailAsync(id);

                MailCreateViewModel viewModel = new MailCreateViewModel()
                {
                    Subject          = $"Re: {mail.Subject}",
                    InReplyToId      = mail.Id,
                    InReplyToSubject = mail.Subject,
                };
                return(View(viewModel));
            }
            catch (GraException gex)
            {
                ShowAlertWarning("Unable to reply to mail: ", gex);
                return(RedirectToAction("Index"));
            }
        }
        public async Task <IActionResult> Reply(int id)
        {
            try
            {
                var mail = await _mailService.GetParticipantMailAsync(id);

                var viewModel = new MailCreateViewModel
                {
                    Subject
                                     = _sharedLocalizer[Annotations.Interface.MailReplyPrefix, mail.Subject],
                    InReplyToId      = mail.Id,
                    InReplyToSubject = mail.Subject,
                };
                return(View(viewModel));
            }
            catch (GraException gex)
            {
                ShowAlertWarning(_sharedLocalizer[ErrorMessages.MailUnableToReply, gex.Message]);
                return(RedirectToAction(nameof(Index)));
            }
        }