internal static IWarehouseCatalog ToWarehouseCatalog(this WarehouseCatalogDisplay warehouseCatalogDisplay, IWarehouseCatalog destination) { if (warehouseCatalogDisplay.Key != Guid.Empty) { destination.Key = warehouseCatalogDisplay.Key; } destination.Name = warehouseCatalogDisplay.Name; destination.Description = warehouseCatalogDisplay.Description; return(destination); }
/// <summary> /// Maps a <see cref="WarehouseCatalogDisplay"/> to a <see cref="IWarehouseCatalog"/>. /// </summary> /// <param name="catalog"> /// The catalog. /// </param> /// <param name="destination"> /// The destination. /// </param> /// <returns> /// The <see cref="WarehouseCatalog"/>. /// </returns> internal static IWarehouseCatalog ToWarehouseCatalog(this WarehouseCatalogDisplay catalog, IWarehouseCatalog destination) { if (!catalog.Key.Equals(Guid.Empty)) { destination.Key = catalog.Key; } destination.Name = catalog.Name; destination.Description = catalog.Description; return(destination); }
public WarehouseCatalogDisplay AddWarehouseCatalog(WarehouseCatalogDisplay catalog) { if (catalog.WarehouseKey.Equals(Guid.Empty)) throw new InvalidDataException("The warehouse key must be assigned"); var warehouseCatalog = _warehouseService.CreateWarehouseCatalogWithKey(catalog.WarehouseKey, catalog.Name, catalog.Description); return warehouseCatalog.ToWarehouseCatalogDisplay(); }
public WarehouseCatalogDisplay PutWarehouseCatalog(WarehouseCatalogDisplay catalog) { var warehouseCatalog = _warehouseService.GetWarehouseCatalogByKey(catalog.Key); warehouseCatalog = catalog.ToWarehouseCatalog(warehouseCatalog); _warehouseService.Save(warehouseCatalog); return warehouseCatalog.ToWarehouseCatalogDisplay(); }