public IHttpActionResult Get()
        {
            var menuList = _secRepository.GetAll();
            var models   = menuList.Select(_modelFactory.Create);

            return(Ok(models));
        }
Example #2
0
        public async Task <QueryResultResource <GetSectionResource> > GetAllSections(ClasseQueryResource filterResource)
        {
            var filter = _mapper.Map <ClasseQueryResource, ClasseQuery>(filterResource);

            var queryResult = await _sectionrepository.GetAll(filter);

            return(_mapper.Map <QueryResult <Section>, QueryResultResource <GetSectionResource> >(queryResult));
        }
Example #3
0
        //
        // GET: /Home/

        public ActionResult Index()
        {
            HomePageModel model = new HomePageModel();

            // Get Latest Ads
            var newAds = annoncesRepository.GetNewAds();

            if (newAds == null)
            {
                throw new HttpException(404, "Recommended Ads not found");
            }

            model.ImgNew      = annoncesRepository.GetNewAds().ToList();
            model.sectionList = sectionRepository.GetAll().OrderBy(x => x.section_order).ToList();

            /* ViewBag.id_commune = new SelectList(communeRepository.GetAll(), "id_commune", "commune");
             * ViewBag.ad_user_type = null;
             * ViewBag.id_category = this.populateCategoryBySection();*/
            return(View(model));
        }
        public ActionResult Create()
        {
            IEnumerable<tb_section> section_list;

            using (sectionRepository = new SectionRepository())
            {
                section_list = sectionRepository.GetAll();
            }

            ViewBag.section = new SelectList(section_list, "id_section", "section_title");
            return View();
        }
Example #5
0
        //Crée une tâche grâce à l'id du tableau passé en paramètre et on l'enregistre directement dans la section "Todo"
        public async Task <TaskDTO> CreateTask(int idBoard, TaskDTO task)
        {
            var board = await boardRepository.GetById(idBoard);

            if (board.IsLocked)
            {
                return(null);
            }

            //Récupère toute les sections, ensuite on récupère la section "Todo" dans les sections qui correspondent au tableau
            var sections = await sectionRepository.GetAll();

            var sectionTodo = sections.Where(id => id.BoardId == idBoard).FirstOrDefault(n => n.Name == "Todo");

            if (sectionTodo == null)
            {
                return(null);
            }

            //crée la tâche avec l'id de la section
            task.SectionId = sectionTodo.Id;
            return(await taskRepository.Create(task));
        }
        public ActionResult Edit(int id)
        {
            IEnumerable<tb_section> section_list;

            using (sectionRepository = new SectionRepository())
            {
                section_list = sectionRepository.GetAll();
            }
            ViewBag.section = new SelectList(section_list, "id_section", "section_title");

            tb_category category = categoryRepository.GetById(id);
            if (category != null)
            {
                return View(category);
            }
            return RedirectToAction("Index", "Category");

        }
        private IDictionary <string, IEnumerable <SelectListItem> > populateCategoryBySection()
        {
            IEnumerable <tb_section>  section  = secRepository.GetAll();
            IEnumerable <tb_category> category = catRepository.GetAll();

            IDictionary <string, IEnumerable <SelectListItem> > categoryBySection = new Dictionary <string, IEnumerable <SelectListItem> >();

            foreach (var sec in section)
            {
                var catList = new List <SelectListItem>();
                foreach (var cat in category.Where(c => c.id_section == sec.id_section))
                {
                    catList.Add(new SelectListItem {
                        Value = cat.id_category.ToString(), Text = cat.category_title
                    });
                }
                categoryBySection.Add(sec.section_title, catList);
            }

            return(categoryBySection);
        }
Example #8
0
 public IEnumerable <Section> GetAll()
 {
     return(_sectionRepository.GetAll());
 }
Example #9
0
        /// <inheritdoc cref="ISectionManager.GetSectionsByEntityUId"/>
        public IEnumerable <Section> GetSectionsByEntityUId(Guid entityUId)
        {
            var allSections = _sectionRepository.GetAll();

            return(allSections.Where(s => s.EntityUId.Equals(entityUId)));
        }
Example #10
0
 public IEnumerable <SectionEntity> GetAllSectionEntities()
 {
     return(sectionRepository.GetAll().Select(section => section.ToBllSection()));
 }
        //
        // GET: /Section/

        public ActionResult Index()
        {
            IEnumerable <tb_section> result = sectionRepository.GetAll();

            return(View(result));
        }
Example #12
0
 public IQueryable <Section> All()
 {
     return(_sectionsRepository.GetAll());
 }
 public IEnumerable <SectionDto> GetAll()
 {
     return(_mapper.Map <IEnumerable <SectionDto> >(_sectionRepository.GetAll()));
 }
Example #14
0
        public IEnumerable <Section> GetSections()
        {
            var sections = sectionRepository.GetAll();

            return(sections);
        }