Last active
December 23, 2018 21:40
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module UpdateProductDimensions | |
open Domain | |
open System | |
let find (productId:int, products: seq<Product>):Option<Product> = | |
products | |
|> 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