public ActionResult Index(ContactFormViewModel contactForm) { if (!ModelState.IsValid) { return(View(contactForm)); } _contactFormService.StoreEntry(new ContactFormEntry { Name = contactForm.Name, Email = contactForm.Email, Subject = contactForm.Subject, MessageBody = contactForm.MessageBody, CreatedUtc = _clock.UtcNow }); return(RedirectToAction("Confirmation")); }
public ActionResult Form(ContactFormEntryViewModel model) { if (string.IsNullOrWhiteSpace(model.Subject)) { model.Subject = T("Contact verzoek").Text; } model.CreatedUtc = DateTime.UtcNow; if (!ModelState.IsValid) { return(View(model)); } var dm = _cFS.StoreEntry(_cFS.Convert(model)); if (dm == null) { _notifier.Add(NotifyType.Warning, T("Er is iets mis gegenaamn tijdens de verwerking van uw bericht.")); return(RedirectToAction("Failed")); } return(RedirectToAction("Confirmation")); }