public TestBankVMResponse GetLocalExamInfo(string centerid) { var sheet = shareRepo.GetAvailableExamSheet(centerid); var testRegis = onsiteRepo.ListTestRegis(centerid); var group = from item in sheet group item by new { item.Subject.SubjectCode, item.Subject.SubjectName, item.Subject.ContentLanguage, item.Subject.Version, //iten.Subject.Voices, TODO : Groupby Voice } into gitem let qty = gitem.Count() let book = testRegis.Where(x => x.SubjectCode == gitem.Key.SubjectCode && x.ExamLanguage == gitem.Key.ContentLanguage).Count() select new ExamSheetOnSiteRespone { SubjectCode = gitem.Key.SubjectCode, SubjectName = gitem.Key.SubjectName, ExamLanguage = gitem.Key.ContentLanguage, Version = gitem.Key.Version, Quantity = qty, Book = book, VoiceLanguage = "th", //TODO : Groupby Voice IsExamEnough = qty >= book }; var result = new TestBankVMResponse { ExamSheets = group.ToList(), }; return(result); }