Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
module UpdateProductDimensions
open Domain
open System
let find (productId:int, products: seq<Product>):Option<Product> =
|> Seq.tryPick<Product, Product>(fun x-> if x.ProductId = productId then Some(x) else None)
let update (productOption: Option<Product>, height, length, weight, width)=
match productOption with
| Some product -> Ok(product.updateDimensions (height, length, weight, width))
| None _ -> Error(new Exception("Product does not exist"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment