コード例 #1
0
        public StationaryTestingProduct CreateStationaryTestingProduct(StationaryTestingProduct stationaryTestingProduct)
        {
            _context.StationaryTestingProducts.Add(stationaryTestingProduct);
            _context.SaveChanges();

            return(stationaryTestingProduct);
        }
コード例 #2
0
        public StationaryTestingProduct GetStationaryTestingProduct(int id)
        {
            StationaryTestingProduct stationaryTestingProduct = _context.StationaryTestingProducts.Where(a => a.Id.Equals(id))
                                                                .SingleOrDefault();

            return(stationaryTestingProduct);
        }
コード例 #3
0
 public StationaryTestingProduct CreateStationaryTestingProduct
     (StationaryTestingProduct stationaryTestingProduct)
 {
     if (stationaryTestingProduct.CalibrationProductId != 0)
     {
         var calibrationProduct = _calibrationProductRepository.
                                  GetCalibrationProduct(stationaryTestingProduct.CalibrationProductId);
         if (calibrationProduct.StationaryTestingProduct != null)
         {
             throw new Exception();
         }
         stationaryTestingProduct.CalibrationProduct = calibrationProduct;
     }
     else
     {
         throw new ArgumentException($"Please, enter ID Calibration ");
     }
     if (stationaryTestingProduct.AuthorId != null)
     {
         stationaryTestingProduct.Author = _authorRepository
                                           .GetAuthor(stationaryTestingProduct.AuthorId.Value);
     }
     return(_stationaryTestingProductRepository.CreateStationaryTestingProduct
                (stationaryTestingProduct));
 }
コード例 #4
0
 public StationaryTestingProduct CreateStationaryTestingProduct
     (StationaryTestingProduct stationaryTestingProduct)
 {
     return(_stationaryTestingProductService
            .CreateStationaryTestingProduct(stationaryTestingProduct));
 }