Пример #1
0
        public ActionResult ResendInvite(string initiativeid, string code, FormCollection collection)
        {
            var initiative    = _initiativeBusiness.GetInitiative(Guid.Parse(initiativeid));
            var developerRole = initiative.DeveloperRoles.Single(x => x.InviteCode == code);

            var enabled = _settingsBusiness.GetEmailSetting().EMailConfirmationEnabled;

            if (enabled)
            {
                var subject = "A reminder for the invitation to " + initiative.Name + " at www.quilt4.com";
                var message = _initiativeBusiness.GenerateInviteMessage(initiativeid, code, string.Empty, Request.Url);

                try
                {
                    _emailBusiness.SendEmail(new List <string> {
                        developerRole.InviteEMail
                    }, subject, message);
                }
                catch (SmtpException e)
                {
                    TempData["InviteError"] = "Could not connect to the email server";
                    return(RedirectToAction("Member", "Initiative", new { id = initiativeid }));
                }
                catch (Exception e)
                {
                    TempData["InviteError"] = "Something went wrong";
                    return(RedirectToAction("Member", "Initiative", new { id = initiativeid }));
                }
            }

            return(RedirectToAction("Member", "Initiative", new { id = initiativeid }));
        }