Ejemplo n.º 1
0
        public async Task <IActionResult> GetDevices(long id)
        {
            var request = new GetDevicesQuery();

            request.Id = id;
            return(Ok(await Mediator.Send(request)));
        }
Ejemplo n.º 2
0
        public async Task ShouldNotReturnNull()
        {
            var query  = new GetDevicesQuery();
            var result = await SendAsync(query);

            result.Lists.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public async Task <List <DeviceDto> > Handle(GetDevicesQuery request, CancellationToken cancellationToken)
        {
            var entities = await _context.Devices.ToListAsync();

            var responseDto = _mapper.Map <List <Device>, List <DeviceDto> >(entities);

            //var response = new TapsDto
            //                {
            //    //PriorityLevels = Enum.GetValues(typeof(PriorityLevel))
            //    //    .Cast<PriorityLevel>()
            //    //    .Select(p => new PriorityLevelDto { Value = (int)p, Name = p.ToString() })
            //    //    .ToList(),

            //    //Lists = await _context.TodoLists
            //    //    .ProjectTo<TodoListDto>(_mapper.ConfigurationProvider)
            //    //    .OrderBy(t => t.Title)
            //    //    .ToListAsync(cancellationToken)
            //};

            return(responseDto);
        }