Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        public virtual ActionResult Index()
        {
            var model = new IndexModel();

            return View(model);
        }