public static List <ProductInOrderTable> ConvertToProductInOrderTable(List <ProductInOrder> productInOrders, int idOrder) { List <ProductInOrderTable> productInOrderTables = new List <ProductInOrderTable>(); for (int i = 0; i < productInOrders.Count; i++) { ProductInOrderTable productInOrderTable = new ProductInOrderTable(); productInOrderTable.Id = -1; productInOrderTable.Name = productInOrders[i].Name; productInOrderTable.OrderId = idOrder; productInOrderTable.ProductId = productInOrders[i].ProductId; productInOrderTable.Quantity = productInOrders[i].Quantity; productInOrderTables.Add(productInOrderTable); } return(productInOrderTables); }
public void SaveProductInOrderTable(ProductInOrderTable productInOrder) { _healthStore.ProductInOrderTables.Add(productInOrder); _healthStore.SaveChanges(); }