public static IEnumerable <Result> GetAllResults(CBTWebAPIContext db) { var answers = db.Users.ToList(); return(answers.Where(x => x.QuestionAndAnswers.Any()).Select(m => new Result { Email = m.Email, FullName = m.FullName, PhoneNumber = m.PhoneNumber, Centre = m.Centre, CorrectANswers = m.QuestionAndAnswers.Where(x => x.Answer == x.CorrectAnswer).Count() })); }
public static IEnumerable <User> GetAllUsers() { var db = new CBTWebAPIContext(); return(db.Users); }