Beispiel #1
0
        public async Task <ActionResult <PeriodDto> > CreatePeriodAsync(CreatePeriodDto periodToCreate)
        {
            var newPeriod = new Period
            {
                Id   = Guid.NewGuid(),
                Name = periodToCreate.Name
            };

            await _periodsRepository.CreatePeriodAsync(newPeriod);

            return(CreatedAtAction(nameof(CreatePeriodAsync), new { id = newPeriod.Id }, newPeriod.AsDto()));
        }
Beispiel #2
0
 public async Task <IEnumerable <PeriodDto> > GetPeriodsAsync()
 {
     return((await _periodsRepository.GetPeriodsAsync()).Select(Period => Period.AsDto()));
 }