public ActionResult Contact(HomeContactViewModel model) { //return user to form if model is not valid if (!ModelState.IsValid) { return View(model); } //if valid, add to db and redirect to success page var contactInfoForm = new ContactForm { Email = model.Email, Name = model.Name, Message = model.Message }; _contactFormRepo.AddContactForm(contactInfoForm); TempData["ContactInfo"] = contactInfoForm; return RedirectToAction("Success"); }
public void AddContactFormTest() { Assert.AreEqual(repo.AddContactForm(mock.MockContactForm).ContactFormID, 4); }