Created
April 14, 2018 10:58
-
-
Save samueleresca/09bc6cdc63a326f244520bcf0fe84f6b to your computer and use it in GitHub Desktop.
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 Blog.FSharpWebAPI.RequestModels | |
open Blog.FSharpWebAPI.Models | |
type CreateUpdateLabelRequest = | |
{ | |
Code: string | |
IsoCode: string | |
Content: string | |
Inactive: bool | |
} | |
member this.HasErrors = | |
if this.Code = null || this.Code = "" then Some "Code is required" | |
else if this.Code.Length > 255 then Some "Code is too long" | |
else if this.IsoCode.Length > 2 then Some "IsoCode is too long" | |
else None | |
member this.GetLabel = { | |
Id= 0; | |
Code = this.Code; | |
IsoCode = this.IsoCode; | |
Content = this.Content; | |
Inactive= this.Inactive | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment