Recently , I'm researching that how to generate create view with nested objects(list of objects) in MVC 5 ?
My objects are like that:
public class MrSurvey
{
public Guid Id { get; set; }
[Required]
[StringLength(128)]
public string UserId { get; set; }
[Required]
[StringLength(75)]
public string Title { get; set; }
public DateTime CreatedDate { get; set; }
public List<MrSurveyQuestion> Questions { get; set; }
}
public class MrSurveyQuestion
{
public Guid Id { get; set; }
public Guid SurveyId { get; set; }
[Required]
[StringLength(250)]
public string QuestionName { get; set; }
public bool IsMultipleChoice { get; set; }
public bool IsSelectOneMoreThan { get; set; }
public List<MrSurveyQption> Options { get; set; }
}
public class MrSurveyQption
{
public Guid Id { get; set; }
public Guid QuestionId { get; set; }
[Required]
[StringLength(140)]
public string OptionName { get; set; }
}
I try to generate create view with my nested objects for days. But I didn't do it. Does anyone suggest that how to create view with these objects? or Are there any examples like that?
Thank you for your kind interest.