public StationaryTestingProduct UpdateStationaryTestingProduct (UpdateStationaryTestingProduct updateStationaryTestingProduct) { if (updateStationaryTestingProduct.CalibrationProductId != 0) { var calibrationProduct = _calibrationProductRepository. GetCalibrationProduct(updateStationaryTestingProduct.CalibrationProductId); if (calibrationProduct.StationaryTestingProduct != null) { throw new Exception(); } updateStationaryTestingProduct.CalibrationProduct = calibrationProduct; } if (updateStationaryTestingProduct.AuthorId != null) { updateStationaryTestingProduct.Author = _authorRepository .GetAuthor(updateStationaryTestingProduct.AuthorId.Value); } return(_stationaryTestingProductRepository.UpdateStationaryTestingProduct (updateStationaryTestingProduct)); }
public StationaryTestingProduct UpdateStationaryTestingProduct(UpdateStationaryTestingProduct updateStationaryTestingProduct) { var stationaryTestingProduct = _context.StationaryTestingProducts.Where(a => a.Id.Equals(updateStationaryTestingProduct.Id)).SingleOrDefault(); if (stationaryTestingProduct is null) { throw new Exception(""); } if (updateStationaryTestingProduct.Author != null) { stationaryTestingProduct.Author = updateStationaryTestingProduct.Author; } if (updateStationaryTestingProduct.CalibrationProduct != null) { stationaryTestingProduct.CalibrationProduct = updateStationaryTestingProduct.CalibrationProduct; } if (updateStationaryTestingProduct.Place != null) { stationaryTestingProduct.Place = updateStationaryTestingProduct.Place; } if (updateStationaryTestingProduct.Date.HasValue) { stationaryTestingProduct.Date = updateStationaryTestingProduct.Date.Value; } if (updateStationaryTestingProduct.AlanInstability.HasValue) { stationaryTestingProduct.AlanInstability = updateStationaryTestingProduct.AlanInstability.Value; } if (updateStationaryTestingProduct.PowerDensity.HasValue) { stationaryTestingProduct.PowerDensity = updateStationaryTestingProduct.PowerDensity.Value; } _context.SaveChanges(); return(stationaryTestingProduct); }
public StationaryTestingProduct UpdateStationaryTestingProduct (UpdateStationaryTestingProduct stationaryTestingProduct) { return(_stationaryTestingProductService.UpdateStationaryTestingProduct (stationaryTestingProduct)); }