public async Task <ActionResult <Product> > PostProduct(Product product) { var p = new Product { Name = product.Name, Price = product.Price, Description = product.Description, StatusDelete = false, StatusLock = false }; _context.Product.Add(p); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProduct", new { id = p.Id }, p)); }
public async Task <ActionResult <User> > RemoveUserAsync(int id) { var user = await _context.User.FindAsync(id); if (user == null) { return(NotFound()); } _context.User.Remove(user); await _context.SaveChangesAsync(); return(user); }