示例#1
0
 public async Task <ActionResult <Order> > CreateOrder([Bind("Id, UserId, Items, Total")] Order order)
 {
     if (ModelState.IsValid)
     {
         _context.Add(order);
         await _context.SaveChangesAsync();
     }
     return(order);
 }
示例#2
0
 public async Task <ActionResult <Product> > CreateProduct([Bind("Id,Title,Description,Price")] Product product)
 {
     if (ModelState.IsValid)
     {
         _context.Add(product);
         await _context.SaveChangesAsync();
     }
     return(product);
 }