public async Task <IActionResult> PutVegaTempDeviceData(long id, VegaTempDeviceData tempDeviceData) { if (tempDeviceData is null) { throw new ArgumentNullException(nameof(tempDeviceData)); } if (id != tempDeviceData.Id || !_repository.ImpulsDeviceDataExists(tempDeviceData.DeviceId)) { return(BadRequest()); } try { await _repository.EditAsync(tempDeviceData).ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { if (!_repository.ImpulsDeviceDataExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <VegaTempDeviceData> > PostVegaTempDeviceData(VegaTempDeviceData tempDeviceData) { if (tempDeviceData is null) { throw new ArgumentNullException(nameof(tempDeviceData)); } if (!_repository.DeviceExists(tempDeviceData.DeviceId)) { return(BadRequest()); } await _repository.AddAsync(tempDeviceData).ConfigureAwait(false); return(CreatedAtAction("GetTempDeviceData", new { id = tempDeviceData.Id }, tempDeviceData)); }