コード例 #1
0
        /*
         * Create new product
         */
        public async Task <GetProductViewModel> CreateProduct(Product product)
        {
            _context.Products.Add(product);
            await _context.SaveChangesAsync();

            return(GetProductViewModel(product));
        }
コード例 #2
0
        /*
         * Create a new customer
         */
        public async Task <GetCustomerViewModel> CreateCustomer(Customer customer)
        {
            _context.Customers.Add(customer);
            var basket = new Basket {
                Customer = customer
            };

            _context.Baskets.Add(basket);
            await _context.SaveChangesAsync();

            return(await GetCustomerViewModel(customer));
        }