Пример #1
0
 public async Task <Response> Handle(Request request, CancellationToken cancellationToken)
 => new Response()
 {
     Frequencies = await _context.Frequencies
                   .Include(x => x.FrequencyType)
                   .Select(x => FrequencyApiModel.FromFrequency(x))
                   .ToListAsync()
 };
Пример #2
0
        public static FrequencyApiModel FromFrequency(Frequency frequency)
        {
            var model = new FrequencyApiModel();

            model.FrequencyId     = frequency.FrequencyId;
            model.Frequency       = frequency.Frequency;
            model.FrequencyTypeId = frequency.FrequencyTypeId;
            model.FrequencyType   = FrequencyTypeApiModel.FromFrequencyType(frequency.FrequencyType);
            return(model);
        }
 public async Task <Response> Handle(Request request, CancellationToken cancellationToken)
 => new Response()
 {
     Frequency = FrequencyApiModel.FromFrequency(await _context.Frequencies.FindAsync(request.FrequencyId))
 };