예제 #1
0
        public IActionResult Index()
        {
            var steps = _stepRepository.GetSteps();

            if (steps.Count() <= 0)
            {
                ViewBag.Message = "There was a problem retrieving steps from database or no step exists";
            }
            return(View(steps));
        }
예제 #2
0
        public IActionResult GetSteps()
        {
            var steps = _stepRepository.GetSteps().ToList();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var stepsDto = new List <StepDto>();

            foreach (var step in steps)
            {
                stepsDto.Add(new StepDto
                {
                    Id            = step.Id
                    , Description = step.Description
                });
            }
            return(Ok(stepsDto));
        }