// 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)); }
public async Task <MeasureQueryDto> Handle(GetMeasureQueryRequest request, CancellationToken cancellationToken) { var measure = await _measureRepository.GetAsync(request.MeasureId); var measureDto = MeasureMapper.Map(measure); return(measureDto); }
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)); }
public async Task <MeasureDto> GetAsync(string name) { var measure = await _measureRepository.GetAsync(name); return(_mapper.Map <Measure, MeasureDto>(measure)); }