public void CreateCustomer(Customer1 customer) { if (PC.Customer.Any(c => c.Email == customer.Email) || customer.Email == null) { Console.WriteLine($"This customer with email {customer.Email} already exists and cannot be added"); return; } else { PC.Customer.Add(Mappings.Mapper.Map(customer)); // this will generate insertMapper.Map(customer) } PC.SaveChanges(); // this will execute the above generate insert query }
public void CreateOrder(Order1 order) { //if (PC.CxOrder.Any(c => c.OrderId == order.) || order.Phone == null) //{ // Console.WriteLine($"This order with username {order.Username} already exists and cannot be added"); // return; //} //else PC.CxOrder.Add(MapOrder.Map(order)); // this will generate insertMapper.Map(order) PC.SaveChanges(); // this will execute the above generate insert query }
public void CreateOrder(TempCustomerOrder1 Order) { PCO.TempCustomerOrder.Add(MapTempCustomerOrder.Map(Order)); PCO.SaveChanges(); }
public void CreatePizza(Pizza1 pizza) { PC.Pizza.Add(MapPizza.Map(pizza)); // this will generate insertMapper.Map(order) PC.SaveChanges(); // this will execute the above generate insert query }