public async Task <IActionResult> Delete(ReportBindingModel model)
        {
            if (model.Id != 0)
            {
                var reportModel = model.ToServiceModel();
                await _reportService.DeleteReportsAsync(reportModel);

                return(RedirectToAction("List", new { model.SurveyId }));
            }

            return(BadRequest());
        }
예제 #2
0
        public async Task <IActionResult> Finish(ReportBindingModel model)
        {
            if (model.Responses.All(rsp => rsp.OptionId != 0))
            {
                var reportModel = model.ToServiceModel();
                await _reportService.AddReportAsync(reportModel);

                return(View());
            }

            var surveyModel = await _surveyService.GetSurveyById(model.SurveyId);

            var viewModel = surveyModel.ToViewModel();

            ModelState.AddModelError("", "It seems like you haven't answerd all the questions");

            return(View("Start", viewModel));
        }