public async Task AddTest() { var fake = Mock.Of <ISurveysRepo>(); var surveyService = new SurveysService(fake); var survey = new Survey() { Question = "test?", Min = 0, Desc1 = "desc1", Max = 10, Desc2 = "desc2", TherapyId = "3" }; await surveyService.AddAndSave(survey); }
public async Task <IActionResult> Create([Bind("Id,Question,Min,Desc1,Max,Desc2,TherapyId")] Survey survey) { if (ModelState.IsValid) { await _surveysService.AddAndSave(survey); return(RedirectToAction(nameof(Index))); } ViewData["TherapyId"] = new SelectList(_surveysService.getTherapies(), "Id", "Id", survey.TherapyId); return(View(survey)); }