コード例 #1
0
        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));
        }
コード例 #2
0
        // 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));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: zraja90/MyApps
 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));
 }