Ejemplo n.º 1
0
        // GET: Entry/Details/5
        public async Task <IActionResult> Details(Guid?id)
        {
            if (!id.HasValue)
            {
                return(NotFound());
            }
            Entry entry = await _repository.GetAsync(id.Value);

            Guid deviceId = entry.Device.Id;

            ViewData[GarduinoConstants.DeviceId] = deviceId;
            return(View(entry));
        }
Ejemplo n.º 2
0
        public async Task <MeasureQueryDto> Handle(GetMeasureQueryRequest request, CancellationToken cancellationToken)
        {
            var measure = await _measureRepository.GetAsync(request.MeasureId);

            var measureDto = MeasureMapper.Map(measure);

            return(measureDto);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetMeasureFromDate([FromRoute] Guid deviceId, [FromRoute] DateTime dateTime)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Device dev = await GetDeviceAsync(deviceId);

            if (dev == null)
            {
                return(NotFound("Device not found"));
            }
            var measure = await _repository.GetAsync(dateTime, dev);

            if (measure is null)
            {
                return(NotFound());
            }
            return(Ok(measure));
        }
Ejemplo n.º 4
0
        public async Task <MeasureDto> GetAsync(string name)
        {
            var measure = await _measureRepository.GetAsync(name);

            return(_mapper.Map <Measure, MeasureDto>(measure));
        }