public IActionResult GetList() { List <ArticleViewModel> listView = new List <ArticleViewModel>(); var articles = _articleService.GetList(); foreach (var article in articles) { var sections = _sectionService.GetByArticleId(article.ArticleId); var authors = _authorService.GetByArticleId(article.ArticleId); var viewModel = new ArticleViewModel { Section = sections, Author = authors, Article = article }; listView.Add(viewModel); } if (listView.Count >= 0) { return(Ok(listView)); } return(BadRequest()); }