Last active
August 29, 2015 13:57
-
-
Save CoreyKaylor/9558825 to your computer and use it in GitHub Desktop.
F# FubuMVC Endpoints Hypothetical
This file contains hidden or 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 CustomerEndpoints | |
let ``GET /customers/list`` (repository: ICustomerRepository) = | |
repository.List | |
|> Seq.map customerToViewRecord | |
type GetCustomerInput = {Id: int;} | |
let ``GET /customers/{Id}`` (repository: ICustomerRepository) (input: GetCustomerInput) = | |
repository.Get input.Id |> customerToViewRecord | |
type EditCustomerInput = {Id: int; FirstName: string; LastName: string;} | |
let ``POST /customers/{Id}/edit`` (repository: ICustomerRepository) (input: EditCustomerInput) = | |
input |> toCustomer |> repository.Save |> ignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment