public virtual void Init(int sectionId, CategoryRepository categoryRepository, ResourcesRepository resourcesRepository) { Categories = categoryRepository.GetList() .ToList(); foreach (var category in Categories) { category.Resources = resourcesRepository.GetList() .Where(r => r.CategoryId == category.Id && r.SectionId == sectionId) .ToList(); } }
public IHttpActionResult Get() { var resources = _resourcesRepository.GetList(); var resourceDto = resources.Select(e => new ResourceListDto() { Id = e.Id, Name = e.Name, URL = e.URL, Description = e.Description, Section = e.Section.Name, Category = e.Category.Name, Technologies = e.Technologies }).ToList(); return(Ok(resourceDto)); }
// GET: Resources All public ActionResult Index() { var resources = _resourcesRepository.GetList(); return(View(resources)); }