public void InSpotInventory(int productId, int warehouseId, int qty, float price, string currency) { SpotInventory model = this.GetSpotInventory(productId, warehouseId); if (model == null) { Product product = this._productService.GetProduct(productId); if (product == null) { throw new EntityIsInvalidException <string>(productId.ToString()); } Warehouse warehouse = this._warehouseService.GetWarehouse(warehouseId); if (warehouse == null) { throw new EntityIsInvalidException <string>(warehouseId.ToString()); } model = new SpotInventory(product, warehouse, qty, price, currency); } else { model.InBound(qty, price); } this._spotInventoryRepository.Save(model); this._uow.Commit(); }
public void OutSpotInventory(int productId, int warehouseId, int qty) { SpotInventory model = this.GetSpotInventory(productId, warehouseId); if (model != null) { model.OutBound(qty); this._uow.Commit(); } }
public static SpotInventoryView ConvertToSpotInventoryView(this SpotInventory model) { return(Mapper.Map <SpotInventory, SpotInventoryView>(model)); }