a form model

This commit is contained in:
Paul Schneider 2016-11-16 10:17:24 +01:00
commit dfa034afcf
5 changed files with 70 additions and 0 deletions

View file

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Model.Forms.Validation;
namespace Yavsc.Model.Forms
{
public abstract class Field
{
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id {  get; set; }
public abstract Method [] ValidationMethods ();
public string Name { get; set; }
public string Label { get; set; }
public string PlaceHolder { get; set; }
public string ValueType { get; set; }
}
}

View file

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace Yavsc.Model.Forms
{
public class FieldSet
{
public string Legend {get; set;}
public List<Field> Fields { get; set; }
}
}

14
Yavsc/Model/Forms/Form.cs Normal file
View file

@ -0,0 +1,14 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.Forms
{
public class Form
{
[Key]
public string Id {get; set;}
public string Summary { get; set; }
public List<IFormNode> Content { get; set; }
}
}

View file

@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.Forms.Validation
{
public class Method
{
[Key]
public string Name {get; set; }
/// <summary>
/// TODO localisation ...
/// </summary>
/// <returns></returns>
[Required]
public string ErrorMessage { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc.Model.Forms.Validation
{
public class Required : Method
{
}
}