コード例 #1
0
        public async Task <CriteriaAlternativeDto> EditAlternative(Guid id)
        {
            var alternatives = await _alternativeService.GetAlternativesByProjectId(id, 1);

            var criterias = await _criteriaService.GetCriteriasByProjectId(id, 1);

            var criteriaAlternativeDto = new CriteriaAlternativeDto();

            var mappedAlternatives = _mapper.Map <IList <AlternativeDto> >(alternatives.OrderBy(a => a.Order));
            var mappedCriterias    = _mapper.Map <IList <CriterionDto> >(criterias.OrderBy(c => c.Order));

            criteriaAlternativeDto.Alternatives = mappedAlternatives;
            criteriaAlternativeDto.Criterias    = mappedCriterias;

            return(criteriaAlternativeDto);
        }
コード例 #2
0
        // GET: Alterntive/EditAlternative
        public async Task <ActionResult> EditAlternative(Guid id)
        {
            ViewBag.id = id;
            var alternatives = await _alternativeService.GetAlternativesByProjectId(id, 1);

            var criterias = await _criteriaService.GetCriteriasByProjectId(id, 1);

            var criteriaAlternativeView = new CriteriaAlternativeView();

            var mappedAlternatives = _mapper.Map <IList <AlternativeView> >(alternatives.OrderBy(a => a.Order));
            var mappedCriterias    = _mapper.Map <IList <CriterionView> >(criterias.OrderBy(c => c.Order));

            criteriaAlternativeView.Alternatives = mappedAlternatives;
            criteriaAlternativeView.Criterias    = mappedCriterias;

            return(View(criteriaAlternativeView));
        }