Beispiel #1
0
        public Initiative GetInitiativeModel(InitiativeCreateDto initiativeCreateDto)
        {
            var initiativeYears  = _yearRepository.GetInitiativeYears();
            var initiativeYearId = initiativeYears.FirstOrDefault(y =>
            {
                if (y == null)
                {
                    throw new ArgumentNullException(nameof(y));
                }
                return(y.Year == initiativeCreateDto.InitiativeYear);
            }).Id;

            return(new Initiative(initiativeCreateDto.Name, initiativeYearId));
        }
        public ActionResult <IEnumerable <InitiativeYearReadDto> > Get()
        {
            var initiativeYears = _repository.GetInitiativeYears();

            return(Ok(_mapper.Map <IEnumerable <InitiativeYearReadDto> >(initiativeYears)));
        }