public static int Insert(InventoryItem inventoryItem) { using (ObjectConnection objectConnection = new ObjectConnection()) { using (InsertInventoryItemCommand objectCommand = new InsertInventoryItemCommand(objectConnection)) { objectCommand.InventoryItemId = (inventoryItem.InventoryItemId != Guid.Empty) ? inventoryItem.InventoryItemId : new Guid(); objectCommand.CatalogItemId = inventoryItem.CatalogItemId; objectCommand.OrderId = inventoryItem.OrderId; objectCommand.InventoryItemStatusId = inventoryItem.InventoryItemStatusId; objectConnection.Open(); objectCommand.ExecuteNonQuery(); return objectCommand.ReturnValue; } } }
public static int Insert(Guid? inventoryItemId, Guid catalogItemId, Guid? orderId, int inventoryItemStatusId) { using (ObjectConnection objectConnection = new ObjectConnection()) { using (InsertInventoryItemCommand objectCommand = new InsertInventoryItemCommand(objectConnection)) { objectCommand.InventoryItemId = inventoryItemId ?? new Guid(); objectCommand.CatalogItemId = catalogItemId; objectCommand.OrderId = orderId; objectCommand.InventoryItemStatusId = inventoryItemStatusId; objectConnection.Open(); objectCommand.ExecuteNonQuery(); return objectCommand.ReturnValue; } } }