//GetItemsForAllSubjects public static List <ItemsForSubject> GetItemsForAllSubjects() { List <Subjects> subjects = SubjectsDL.GetAllSubjects(); List <ItemsForSubject> itemsForSubjects = new List <ItemsForSubject>(); foreach (var subject in subjects) { var result = GetItemsBySubjectId(subject.SubjectId); if (result != null) { itemsForSubjects.Add(result); } } return(itemsForSubjects); }
//GetAll public static List <Subjects1> GetAllSubjects() { return(SubjectsConvertor.ConvertToListDto(SubjectsDL.GetAllSubjects())); }
//GetContainName public static List <Subjects1> GetSubjectContainText(string text) { List <Subjects> lst = new List <Subjects>(SubjectsDL.GetAllSubjects()); return(SubjectsConvertor.ConvertToListDto(lst.Where(k => k.Subject.Contains(text)).ToList())); }
//GetByName public static Subjects1 GetSubjectByName(string subject) { List <Subjects> lst = new List <Subjects>(SubjectsDL.GetAllSubjects()); return(SubjectsConvertor.ConvertToDto(lst.Where(k => k.Subject.Equals(subject)).FirstOrDefault())); }