예제 #1
0
 /// <summary>
 /// Adds a product to the data store
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public Task AddProductAsync(Product p)
 {
     _context.Add(p);
     // If you dont await this it will return as Task
     // In this case we want it to return as Task
     return(_context.SaveChangesAsync());
 }
예제 #2
0
        /// <summary>
        /// Adds a product to the data store
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public Task AddProductAsync(Product p)
        {
            _context.Add(p);
            return(_context.SaveChangesAsync());

            //throw new NotImplementedException();
        }
예제 #3
0
 /// <summary>
 /// Adds a product to the data store.
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public Task AddProductAsync(Product p)
 {
     _context.Add(p);
     return(_context.SaveChangesAsync());
 }