public virtual ActionResult SendEmail(IndexModel model) { if (!ModelState.IsValid) { return RedirectToAction(MVC.Contact.Index()); } Email email = _mapper.Map<IndexModel, Email>(model); try { _emailSenderService.Send(email); } catch (ValidationException e) { ControllerUtil.AddModelErrors(ModelState, e); return RedirectToAction(MVC.Contact.Index()); } ViewData.Model = _mapper.Map<IndexModel, EmailSentModel>(model); return RedirectToAction(MVC.Contact.EmailSent()); }
public virtual ActionResult Index() { var model = new IndexModel(); return View(model); }