Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public CreateTechnicCommand(string name, string email, int age, string productname, int quantity)
- {
- this.name = name;
- this.email = email;
- this.age = age;
- this.productname = productname;
- this.quantity = quantity;
- }
- public void Execute()
- {
- using(Technic context = new Technic())
- {
- Customer customer = new Customer()
- {
- Name = this.name,
- Email = this.email,
- Age = this.age
- };
- Order order = new Order()
- {
- ProductName = this.productname,
- Quantity = this.quantity,
- Customer = customer
- };
- context.Customers.Add(customer);
- context.Orders.Add(order);
- context.SaveChanges();
- }
- Console.WriteLine("Record is Created");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement