public IActionResult Contact(ContactUseViewModel model) { if (ModelState.IsValid) { JumpStart.Entities.Models.ContactUs objContactUs = mapper.Map <JumpStart.Entities.Models.ContactUs>(model); contactUsService.Add(objContactUs); return(RedirectToAction("Contact")); } return(View(model)); }
// Post: ContactUs public virtual ActionResult Index(ContactUsViewModel model) { if (!ModelState.IsValid) { ViewBag.State = false; return(View(model)); } _contactUsService.Add(model); _uow.SaveAllChanges(); ViewBag.State = true; return(View(model)); }
public ActionResult SubmitContactForm(ContactUsViewModel contactUsViewModel) { if (ModelState.IsValid) { if (contactUsViewModel != null) { contactUsViewModel.DateCreated = DateTime.UtcNow; var contact = Mapper.Map <ContactUsViewModel, Contatctu>(contactUsViewModel); _contactUsService.Add(contact); } } return(RedirectToAction("Index")); }
public ActionResult Contact(ContactUsModel model) { if (ModelState.IsValid) { try { var entity = model.ToEntity(); _contactUsService.Add(entity); _workflowMessageService.SendContactEmail(model.EmailAddress, model.Name, model.Message); this.SuccessNotification("Thank you for contacting us. We will respond withing 24-48 hours."); model = new ContactUsModel(); } catch (Exception) { this.ErrorNotification(GlobalHelper.DefaultFormSubmissionErrorMessage); throw; } } return(View(model)); }