public void CanFail3CreateContact() { IContactRecordRepository repo = RepoFactory.CreateContactRecordRepo(); ContactRecord record = new ContactRecord() { Email = "*****@*****.**", Name = "TestContact", Message = "", Phone = "701-701-7011" }; var result = repo.Create(record); Assert.AreEqual(null, result); }
public void CanCreate3Contact() { IContactRecordRepository repo = RepoFactory.CreateContactRecordRepo(); ContactRecord record = new ContactRecord() { Email = "*****@*****.**", Name = "TestContact", Message = "Blah blah", Phone = "" }; var result = repo.Create(record); Assert.GreaterOrEqual(1, result.ContactRecordId); Assert.AreEqual(record, result); }
public ActionResult Contact(ContactRecord model) { if (model.Email == null && model.Phone == null) { ModelState.AddModelError("Error", "Either Provide an Email or phone"); return(View(model)); } if (ModelState.IsValid) { IContactRecordRepository repo = RepoFactory.CreateContactRecordRepo(); repo.Create(model); ModelState.AddModelError("Error", "Your response has been submitted"); return(View(new ContactRecord())); } else { return(View(model)); } }