public IActionResult GetState(int id, bool includeCounties = false) { var state = _myAppRepository.GetState(id, includeCounties); if (state == null) { return(NotFound()); } if (includeCounties) { return(Ok(_mapper.Map <StateDto>(state))); } return(Ok(_mapper.Map <StateWithoutCountiesDto>(state))); }