public static List <string> GetReplacedPicturesList(PollBase <TQuestion> oldPollBase, PollBase <TQuestion> newPollBase) { var replacedPictures = new List <string>(); foreach (var oldQuestion in oldPollBase.Questions) { var newQuestion = newPollBase.Questions.SingleOrDefault(question => question.Id == oldQuestion.Id); if (newQuestion == null) { continue; } if (newQuestion.PictureId != oldQuestion.PictureId) { replacedPictures.Add(oldQuestion.PictureId); } replacedPictures.AddRange(oldQuestion.AnswerOptions.Select(oldOption => oldOption.PictureId).Where(oldOption => !newQuestion.AnswerOptions.Select(newOption => newOption.PictureId).Contains(oldOption))); } return(replacedPictures); }
public bool CheckCompleted <TQuestion>(PollBase <TQuestion> pollBase) where TQuestion : Question { return(pollBase.Questions.Select(question => question.Id).All(id => Answers.Select(answer => answer.QuestionId).Contains(id))); }