示例#1
0
        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();
            }
        }
示例#2
0
        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));
        }
示例#3
0
        // GET: Resources All
        public ActionResult Index()
        {
            var resources = _resourcesRepository.GetList();

            return(View(resources));
        }