public IActionResult Survey(SurveyViewModel newSurvey) { IActionResult result = null; if (GetUserManager().IsAuthenticated) { newSurvey.Email = GetUserManager().User.Email; _db.CreateSurvey(newSurvey); result = RedirectToAction("Survey"); } else { result = RedirectToAction("Login", "User"); } return(result); }
public void TestSurvey() { SurveyViewModel sT = new SurveyViewModel() { ParkCode = "AIK", Email = "*****@*****.**", State = "DC", ActivityLevel = "Active" }; bool success = _db.CreateSurvey(sT); Assert.AreEqual(true, success); var st = _db.GetSurveyByCode("AIK"); Assert.AreEqual("DC", st[0].State); Assert.AreEqual("*****@*****.**", st[0].Email); Assert.AreEqual("Active", st[0].ActivityLevel); }