Exemple #1
0
        public async Task <IActionResult> PutVegaMagnetDeviceData(long id, VegaMagnetDeviceData vegaMagnetDeviceData)
        {
            if (vegaMagnetDeviceData is null)
            {
                throw new ArgumentNullException(nameof(vegaMagnetDeviceData));
            }

            if (id != vegaMagnetDeviceData.Id || !_repository.MagnetDeviceExists(vegaMagnetDeviceData.Id))
            {
                return(BadRequest());
            }

            try
            {
                await _repository.EditVegaDeviceDataAsync(vegaMagnetDeviceData).ConfigureAwait(false);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_repository.MagnetDeviceDataExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public Task EditVegaDeviceDataAsync(VegaMagnetDeviceData vegaMoveDeviceData, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
        public async Task <ActionResult <VegaMagnetDeviceData> > PostVegaMagnetDeviceData(VegaMagnetDeviceData vegaMagnetDeviceData)
        {
            if (vegaMagnetDeviceData is null)
            {
                throw new ArgumentNullException(nameof(vegaMagnetDeviceData));
            }

            if (!_repository.MagnetDeviceExists(vegaMagnetDeviceData.Id))
            {
                return(BadRequest());
            }

            await _repository.AddVegaMagnetDeviceDataAsync(vegaMagnetDeviceData).ConfigureAwait(false);

            return(CreatedAtAction("GetMagnetDeviceData", new { id = vegaMagnetDeviceData.Id }, vegaMagnetDeviceData));
        }