Answer

A question will most likely require some answers. Right-click on the /Data/Models/ folder and add the following Answer.cs class file:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace TestMakerFreeWebApp.Data
{
public class Answer
{
#region Constructor
public Answer()
{

}
#endregion

#region Properties
[Key]
[Required]
public int Id { get; set; }

[Required]
public int QuestionId { get; set; }

[Required]
public string Text { get; set; }

[Required]
public int Value { get; set; }

public string Notes { get; set; }

[DefaultValue(0)]
public int Type { get; set; }

[DefaultValue(0)]
public int Flags { get; set; }

[Required]
public DateTime CreatedDate { get; set; }

[Required]
public DateTime LastModifiedDate { get; set; }
#endregion
}
}

Again, we only have the foreign key that we need to traverse up the one-to-many dependency tree that we're slowly building. There's also a new Value property that we can use to give a variable weight to different answers. That value can be a positive or even a negative number, depending on how we want to implement our quiz backend mechanics. There will be chances to talk more about this soon.

It seems that we're only missing the results here; let's add them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.50.222