public static void CreateOrUpdateInventoryItems(IInventoryItemApplicationService invItemApplicationService, IList <ICreateInventoryItemEntry> inventoryItemEntries) { foreach (var e in inventoryItemEntries) { var iitem = invItemApplicationService.Get(e.InventoryItemId); if (iitem == null) { var createInventoryItem = new CreateInventoryItem(); createInventoryItem.InventoryItemId = e.InventoryItemId; createInventoryItem.Entries.Add(e); invItemApplicationService.When(createInventoryItem); } else { var updateInventoryItem = new MergePatchInventoryItem(); updateInventoryItem.InventoryItemId = e.InventoryItemId; updateInventoryItem.Version = iitem.Version; // ///////////////// updateInventoryItem.InventoryItemEntryCommands.Add(e); invItemApplicationService.When(updateInventoryItem); } } }
public static IEnumerable <IInventoryItemState> GetByProperty <TPropertyType>(this IInventoryItemApplicationService applicationService, System.Linq.Expressions.Expression <Func <IInventoryItemState, TPropertyType> > propertySelector, TPropertyType propertyValue, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue) { return(applicationService.GetByProperty(ReflectUtils.GetPropertyName <IInventoryItemState, TPropertyType>(propertySelector), propertyValue, orders, firstResult, maxResults)); }