public ActionResult SubmitMessageWidget() { var model = new SubmitMessageViewModel(); if (UserHelper.IsLoggedIn) { model.Name = UserHelper.FullName; model.EmailAddress = UserHelper.EmailAddress; } return(PartialView("_SubmitMessageWidget", model)); }
public ActionResult SubmitMessageWidget(SubmitMessageViewModel model) { EmailHelper.Send( _userService.Get(new List <string> { nameof(Admin) }).Select(x => x.EmailAddress).ToList(), "Contact Submitted", $@"<p>Hello, we thought you might like to know that a visitor to your website has submitted a message, here are the details we recorded.</p> <p>Name: {model.Name}</p> <p>Email Address: {model.EmailAddress}</p> <p>Subject: {model.Subject}</p> <p>Message: {model.Message}</p>"); return(RedirectToAction("Index", "Home", new { area = "" })); }
public async Task <ActionResult> SubmitMessageWidget(SubmitMessageViewModel model) { var recipients = await _userService.GetByRoleAsync(new List <string> { nameof(Admin) }); await EmailHelper.SendContactUsMessageAsync( recipients.Select(x => x.Email).First(), model.Name, model.EmailAddress, model.Subject, model.Message); return(RedirectToAction("Index", "Home", new { area = "" })); }