public static CollectionInfo GetCollectionInfoById(string CollectionId) { using (MainDataContext db = new MainDataContext()) { var res = db.CollectionInfos.FirstOrDefault(p => p.CollectionID.ToString() == CollectionId); db.Dispose(); return res; } }
public static int GetAnswerCountByCollectionId(string CollectionId) { using (MainDataContext db = new MainDataContext()) { var res= db.CollectionQuestionAndAnswers.Count(p => p.CollectionID.ToString() == CollectionId); db.Dispose(); return res; } }