public MobileTestingProduct CreateMobileTestingProduct (MobileTestingProduct mobileTestingProduct) { if (mobileTestingProduct.ConfiguringProductId != 0) { var configurongProduct = _configuringProductRepository. GetConfiguringProduct(mobileTestingProduct.ConfiguringProductId); if (configurongProduct.MobileTestingProduct != null) { throw new Exception(); } mobileTestingProduct.ConfiguringProduct = configurongProduct; } else { throw new ArgumentException($"Please, enter ID Configuring "); } if (mobileTestingProduct.AuthorId != null) { mobileTestingProduct.Author = _authorRepository .GetAuthor(mobileTestingProduct.AuthorId.Value); } return(_mobileTestingProductRepository. CreateMobileTestingProduct(mobileTestingProduct)); }
public MobileTestingProduct CreateMobileTestingProduct(MobileTestingProduct mobileTestingProduct) { _context.MobileTestingProducts.Add(mobileTestingProduct); _context.SaveChanges(); return(mobileTestingProduct); }
public MobileTestingProduct GetMobileTestingProduct(int id) { MobileTestingProduct mobileTestingProduct = _context.MobileTestingProducts .Include(a => a.CalibrationProduct) .Where(a => a.Id.Equals(id)) .SingleOrDefault(); return(mobileTestingProduct); }
public MobileTestingProduct CreateMobileTestingProduct(MobileTestingProduct mobileTestingProduct) { return(_mobileTestingProductService.CreateMobileTestingProduct(mobileTestingProduct)); }