Add person add/edit/delete in settings (#17)
This commit is contained in:
@@ -776,6 +776,41 @@ type EditPageModel() =
|
||||
| _ -> revision :: page.Revisions }
|
||||
|
||||
|
||||
/// <summary>View model to edit a person</summary>
|
||||
type EditPersonModel() =
|
||||
|
||||
/// <summary>The ID of the person being edited</summary>
|
||||
member val Id = "" with get, set
|
||||
|
||||
/// <summary>The name of the person</summary>
|
||||
member val Name = "" with get, set
|
||||
|
||||
/// <summary>A URL for this person's profile</summary>
|
||||
member val ProfileUrl = "" with get, set
|
||||
|
||||
/// <summary>A URL to the image for this person</summary>
|
||||
member val ImageUrl = "" with get, set
|
||||
|
||||
/// <summary>Create an edit model from a person</summary>
|
||||
/// <param name="person">The person for whom the edit model is created</param>
|
||||
static member FromPerson(person: Person) =
|
||||
let model = EditPersonModel()
|
||||
model.Id <- string person.Id
|
||||
model.Name <- person.Name
|
||||
model.ProfileUrl <- defaultArg person.Url ""
|
||||
model.ImageUrl <- defaultArg person.ImageUrl ""
|
||||
model
|
||||
|
||||
/// <summary>Update a person with values from this model</summary>
|
||||
/// <param name="person">The person to be updated</param>
|
||||
/// <returns>A person with their values updated</returns>
|
||||
member this.UpdatePerson(person: Person) =
|
||||
{ person with
|
||||
Name = this.Name
|
||||
Url = noneIfBlank this.ProfileUrl
|
||||
ImageUrl = noneIfBlank this.ImageUrl }
|
||||
|
||||
|
||||
/// <summary>View model to edit a post</summary>
|
||||
type EditPostModel() =
|
||||
inherit EditCommonModel()
|
||||
|
||||
Reference in New Issue
Block a user