예제 #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));
 }
 public StationaryTestingProduct CreateStationaryTestingProduct
     (StationaryTestingProduct stationaryTestingProduct)
 {
     return(_stationaryTestingProductService
            .CreateStationaryTestingProduct(stationaryTestingProduct));
 }