added input validation for poll creation
This commit is contained in:
parent
2a69ccc1b6
commit
1f5a1f4fe2
3 changed files with 37 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
|||
namespace Lieb.Models.Poll
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.Poll
|
||||
{
|
||||
public enum AnswerType
|
||||
{
|
||||
|
@ -8,6 +10,9 @@
|
|||
public class Poll
|
||||
{
|
||||
public int PollId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(200, ErrorMessage = "Question too long (200 character limit).")]
|
||||
public string Question { get; set; }
|
||||
public ICollection<PollOption> Options { get; set; } = new List<PollOption>();
|
||||
public ICollection<PollAnswer> Answers { get; set; } = new List<PollAnswer>();
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
namespace Lieb.Models.Poll
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.Poll
|
||||
{
|
||||
public class PollOption
|
||||
{
|
||||
public int PollOptionId { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "Option too long (100 character limit).")]
|
||||
public string Name { get; set;} = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue