public static void Add(EditableOrder order) { int id = GetAllRecords().Max(o => o.OrderID); order.OrderID = id + 1; GetAllRecords().Insert(0, order); }
public static void Delete(List <EditableOrder> order) { foreach (var temp in order) { EditableOrder result = GetAllRecords().Where(o => o.OrderID == temp.OrderID).FirstOrDefault(); GetAllRecords().Remove(result); } }
public static void Update(EditableOrder order) { EditableOrder result = GetAllRecords().Where(o => o.OrderID == order.OrderID).FirstOrDefault(); if (result != null) { result.OrderID = order.OrderID; result.OrderDate = order.OrderDate; result.CustomerID = order.CustomerID; result.EmployeeID = order.EmployeeID; result.Freight = order.Freight; result.ShipAddress = order.ShipAddress; result.ShipCity = order.ShipCity; result.ShipName = order.ShipName; result.ShipPostalCode = order.ShipPostalCode; result.ShipRegion = order.ShipRegion; result.ShipCountry = order.ShipCountry; result.Verified = order.Verified; } }
public static void Update(List <EditableOrder> order) { foreach (var temp in order) { EditableOrder result = GetAllRecords().Where(o => o.OrderID == temp.OrderID).FirstOrDefault(); if (result != null) { result.OrderID = temp.OrderID; result.OrderDate = temp.OrderDate; result.CustomerID = temp.CustomerID; result.EmployeeID = temp.EmployeeID; result.Freight = temp.Freight; result.ShipAddress = temp.ShipAddress; result.ShipCity = temp.ShipCity; result.ShipName = temp.ShipName; result.ShipPostalCode = temp.ShipPostalCode; result.ShipRegion = temp.ShipRegion; result.ShipCountry = temp.ShipCountry; result.Verified = temp.Verified; } } }
public static void Delete(int OrderID) { EditableOrder result = GetAllRecords().Where(o => o.OrderID == OrderID).FirstOrDefault(); GetAllRecords().Remove(result); }