public IActionResult GetStep(int stepId) { if (!_stepRepository.StepExists(stepId)) { return(NotFound()); } var step = _stepRepository.GetStep(stepId); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var stepDto = new StepDto() { Id = step.Id, Description = step.Description }; return(Ok(stepDto)); }
public IActionResult GetStepById(int stepId) { var step = _stepRepository.GetStep(stepId); if (step == null) { ModelState.AddModelError("", "Error getting a category"); ViewBag.Message = $"There was a problem retrieving step with id {stepId} " + $"from the database or no step with that id exists"; step = new StepDto(); } return(View(step)); }