Example #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,Question,Min,Desc1,Max,Desc2,TherapyId")] Survey survey)
        {
            if (id != survey.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _surveysService.Update(survey);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SurveyExists(survey.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TherapyId"] = new SelectList(_surveysService.getTherapies(), "Id", "Id", survey.TherapyId);
            return(View(survey));
        }
Example #2
0
        public async Task UpdateTest()
        {
            var fake          = Mock.Of <ISurveysRepo>();
            var surveyService = new SurveysService(fake);

            var survey = new Survey()
            {
                Question = "test1?", Min = 0, Desc1 = "desc1", Max = 9, Desc2 = "desc2", TherapyId = "1"
            };
            await surveyService.Update(survey);
        }