예제 #1
0
        public async Task <int> SaveProduct(Product product)
        {
            if (product == null)
            {
                throw new ArgumentNullException($"{nameof(product)} can not be null");
            }

            _productServiceDbContext.Add(product);
            return(await _productServiceDbContext.SaveChangesAsync());
        }
예제 #2
0
 public void Add(Product product)
 {
     _context.Add(product);
     _context.SaveChanges();
 }