public FormPageModel(NavigationMenuModel menuModel, IEnumerable <Question> questions = null) : base(FORM_HEADER_TEXT, menuModel) { Questions = questions ?? new List <Question>(); Answers = Questions.Aggregate(new List <Answer>(), (A, Q) => A.Concat(Q.AnswerVariants.Select(V => new Answer() { question_id = Q.Id, variant_id = V.Id, selected = false })).ToList()); }
public bool Equals(Test other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } var returned = Id == other.Id && Title == other.Title && CreationDate.Equals(other.CreationDate) && State == other.State; returned = returned && Questions.Aggregate(returned, (current, question) => current && other.Questions.Contains(question)); return(returned); }