public CommandResult Update(ProductCreateUpdateReadViewModel viewModel) { var productUpdate = ProductCreateUpdateMapping.GetProductUpdateCommand(viewModel); var warehouseCommandList = ProductCreateUpdateMapping.GetWarehouseList(viewModel); return(_productComandsHandler.Update(productUpdate, warehouseCommandList)); }
public static List <WarehouseCreateCommand> GetWarehouseList(ProductCreateUpdateReadViewModel viewModel) { return(viewModel .Inventory .Warehouses .Select(x => new WarehouseCreateCommand(x.Locality, x.Quantity, x.Type)) .ToList()); }
public static ProductUpdateCommand GetProductUpdateCommand(ProductCreateUpdateReadViewModel viewModel) { return(new ProductUpdateCommand(sku: viewModel.Sku, name: viewModel.Name)); }
public IActionResult Put([FromBody] ProductCreateUpdateReadViewModel product) { return(Response(_productService.Update(product))); }