public MobileTestingProduct UpdateMobileTestingProduct(UpdateMobileTestingProduct updateMobileTestingProduct)
        {
            var mobileTestingProduct = _context.MobileTestingProducts.Where(a => a.Id.Equals(updateMobileTestingProduct.Id)).SingleOrDefault();

            if (mobileTestingProduct is null)
            {
                throw new Exception("");
            }

            if (updateMobileTestingProduct.Author != null)
            {
                mobileTestingProduct.Author = updateMobileTestingProduct.Author;
            }
            if (updateMobileTestingProduct.ConfiguringProduct != null)
            {
                mobileTestingProduct.ConfiguringProduct = updateMobileTestingProduct.ConfiguringProduct;
            }
            if (updateMobileTestingProduct.Place != null)
            {
                mobileTestingProduct.Place = updateMobileTestingProduct.Place;
            }
            if (updateMobileTestingProduct.CalibrationProduct != null)
            {
                mobileTestingProduct.CalibrationProduct = updateMobileTestingProduct.CalibrationProduct;
            }

            if (updateMobileTestingProduct.Date.HasValue)
            {
                mobileTestingProduct.Date = updateMobileTestingProduct.Date.Value;
            }
            if (updateMobileTestingProduct.Nonlinearity.HasValue)
            {
                mobileTestingProduct.Nonlinearity = updateMobileTestingProduct.Nonlinearity.Value;
            }
            if (updateMobileTestingProduct.Inaccuracy.HasValue)
            {
                mobileTestingProduct.Inaccuracy = updateMobileTestingProduct.Inaccuracy.Value;
            }
            if (updateMobileTestingProduct.СhangeShiftZero.HasValue)
            {
                mobileTestingProduct.СhangeShiftZero = updateMobileTestingProduct.СhangeShiftZero.Value;
            }
            if (updateMobileTestingProduct.СhangeTransformation.HasValue)
            {
                mobileTestingProduct.СhangeTransformation = updateMobileTestingProduct.СhangeTransformation.Value;
            }
            if (updateMobileTestingProduct.HysteresisShiftZero.HasValue)
            {
                mobileTestingProduct.HysteresisShiftZero = updateMobileTestingProduct.HysteresisShiftZero.Value;
            }
            if (updateMobileTestingProduct.HysteresisTransformation.HasValue)
            {
                mobileTestingProduct.HysteresisTransformation = updateMobileTestingProduct.HysteresisTransformation.Value;
            }

            _context.SaveChanges();

            return(mobileTestingProduct);
        }
예제 #2
0
        public MobileTestingProduct UpdateMobileTestingProduct
            (UpdateMobileTestingProduct updateMobileTestingProduct)
        {
            if (updateMobileTestingProduct.ConfiguringProductId != 0)
            {
                var configurongProduct = _configuringProductRepository.
                                         GetConfiguringProduct(updateMobileTestingProduct.ConfiguringProductId);
                if (configurongProduct.MobileTestingProduct != null)
                {
                    throw new Exception();
                }
                updateMobileTestingProduct.ConfiguringProduct = configurongProduct;
            }
            if (updateMobileTestingProduct.AuthorId != null)
            {
                updateMobileTestingProduct.Author = _authorRepository
                                                    .GetAuthor(updateMobileTestingProduct.AuthorId.Value);
            }

            return(_mobileTestingProductRepository.UpdateMobileTestingProduct
                       (updateMobileTestingProduct));
        }
 public MobileTestingProduct UpdateMobileTestingProduct(UpdateMobileTestingProduct mobileTestingProduct)
 {
     return(_mobileTestingProductService.UpdateMobileTestingProduct(mobileTestingProduct));
 }