public static async void PrintTableOrderLines() { string encConnection = ConfigurationManager.ConnectionStrings["WideWorldImportersEntities"].ConnectionString; OrderLinesBll orderLinesBll = new OrderLinesBll(encConnection); try { List <OrderLines> orderLines = await orderLinesBll.GetOrderLinesAsync(); if (orderLines != null) { orderLines.ForEach(o => { Console.WriteLine("OrderLine " + o.OrderLineID); Console.Write("OrderID >> " + o.OrderID + " - "); Console.Write("StockItemID >> " + o.StockItemID + " - "); Console.Write("Description >> " + o.Description + " - "); Console.Write("UnitPrice >> " + o.UnitPrice + " - "); Console.WriteLine(""); }); } } catch (Exception ex) { throw; } }
static void Main(string[] args) { Console.WriteLine("Entity Framework"); try { string encConnection = ConfigurationManager.ConnectionStrings["WideWorldImportersEntities"].ConnectionString; OrderLinesBll orderLinesBll = new OrderLinesBll(encConnection); OrderLines orderLines = orderLinesBll.GetOrderLinesById(231411); Console.WriteLine("OrderLine 31411"); Console.Write("OrderLineID >> " + orderLines.OrderLineID + " - "); Console.Write("Description >> " + orderLines.Description + " - "); Console.Write("UnitPrice >> " + orderLines.UnitPrice + " - "); Console.WriteLine("---------------------------------------------"); //actualizamos orderLines.Description = "Esta es una nueva Descripcion"; orderLines.UnitPrice = 140; OrderLines orderLinesUpd = orderLinesBll.UpdateOrderLines(orderLines); Console.WriteLine("OrderLine 31411 Despues de la actualizacion"); Console.Write("OrderLineID >> " + orderLines.OrderLineID + " - "); Console.Write("Description >> " + orderLines.Description + " - "); Console.Write("UnitPrice >> " + orderLines.UnitPrice + " - "); Console.ReadKey(); } catch (Exception ex) { throw; } }