public async void AddTerritory(Territories territoryToAdd) { if (territoryToAdd == null) { throw new ArgumentNullException(nameof(territoryToAdd)); } await _context.AddAsync(territoryToAdd); }
public async void AddSupplier(Suppliers supplierToAdd) { if (supplierToAdd == null) { throw new ArgumentNullException(nameof(supplierToAdd)); } await _context.AddAsync(supplierToAdd); }
public async void AddProduct(Products productToAdd) { if (productToAdd == null) { throw new ArgumentNullException(nameof(productToAdd)); } await _context.AddAsync(productToAdd); }
public async void AddEmployee(Employees employeeToAdd) { if (employeeToAdd == null) { throw new ArgumentNullException(nameof(employeeToAdd)); } await _context.AddAsync(employeeToAdd); }
public async void AddRegion(Regions regionToAdd) { if (regionToAdd == null) { throw new ArgumentNullException(nameof(regionToAdd)); } await _context.AddAsync(regionToAdd); }
public async void AddCustomer(Customers customerToAdd) { if (customerToAdd == null) { throw new ArgumentException(nameof(customerToAdd)); } await _context.AddAsync(customerToAdd); }
public async void AddOrder(Orders orderToAdd) { if (orderToAdd == null) { throw new ArgumentNullException(nameof(orderToAdd)); } await _context.AddAsync(orderToAdd); }
//C.R.U.D //Read public async Task CreateProduct(Product product) { //What happens if the product exists ? var foundProduct = _northwindContext.Products.Any(x => x.ProductId == product.ProductId); if (!foundProduct) { await _northwindContext.AddAsync(product); await _northwindContext.SaveChangesAsync(); } }
public async Task Create(T entity) { await _dbContext.AddAsync(entity); await SaveAsync(); }