public Models.Products.ProductInventoryUpdateResponse InventoryUpdate(Models.Products.ProductInventoryUpdateRequest request) { if (request.Products == null || request.Products.Length == 0) { return new Models.Products.ProductInventoryUpdateResponse { Error = "Products not supplied" } } ; var user = Models.User.UserConfig.Load(request.AuthorizationToken); if (user == null) { return new Models.Products.ProductInventoryUpdateResponse { Error = "User not found" } } ; var response = new Models.Products.ProductInventoryUpdateResponse(); foreach (var product in request.Products) { if (product.SKU == "MyNonExistantSKU") { response.Products.Add(new Models.Products.ProductInventoryResponse { SKU = product.SKU, Error = "SKU does not exist" }); } } return(response); }
public Models.Products.ProductInventoryUpdateResponse InventoryUpdate(Models.Products.ProductInventoryUpdateRequest request) { if (request.Products == null || request.Products.Length == 0) return new Models.Products.ProductInventoryUpdateResponse { Error = "Products not supplied" }; var user = Models.User.UserConfig.Load(request.AuthorizationToken); if (user == null) return new Models.Products.ProductInventoryUpdateResponse { Error = "User not found" }; var response = new Models.Products.ProductInventoryUpdateResponse(); foreach(var product in request.Products) { if(product.SKU == "MyNonExistantSKU") { response.Products.Add(new Models.Products.ProductInventoryError { SKU = product.SKU, Error = "SKU does not exist" }); } } return response; }