public IActionResult GetArticle() { var results = _articlesRepository.GetAll(); if (results != null) { foreach (var item in results) { item.Category = _categoriesRepository.Find(item.CategoryId); } } return(new ObjectResult(results)); }
public IActionResult GetCategory([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var category = _categoriesRepository.Find(id); if (category == null) { return(NotFound()); } return(Ok(category)); }
public IActionResult Categories(int take = 10, int skip = 0, string filter = "", string order = "") { var list = _categoriesRepository.Find(take, skip, filter, order); return(Ok(list)); }