public List<ScheduleMin> GetAllSchedulesMin(ref List<string> errors) { List<ScheduleMin> pocoScheduleList = new List<ScheduleMin>(); IEnumerable<course_schedule> db_ScheduleList; try { db_ScheduleList = this.context.course_schedule.OrderBy(x => x.year); foreach (course_schedule sched in db_ScheduleList) { ScheduleMin tempPoco = new ScheduleMin(); tempPoco.Year = sched.year.ToString(); tempPoco.Quarter = sched.quarter; pocoScheduleList.Add(tempPoco); } } catch (Exception e) { errors.Add("Error occured in ScheduleRepository.GetAllSchedules: " + e); } return pocoScheduleList; }
public string DeleteAllFromSchedule(ScheduleMin schedule) { var errors = new List<string>(); var repository = new ScheduleRepository(this.entities); var service = new ScheduleService(repository); service.RemoveWholeSchedule(schedule.Year, schedule.Quarter, ref errors); if (errors.Count == 0) { return "ok"; } return "error"; }
public List<ScheduleMin> GetStudentScheduleMin(string id, ref List<string> errors) { List<ScheduleMin> pocoScheduleList = new List<ScheduleMin>(); IEnumerable<course_schedule> db_ScheduleList; try { db_ScheduleList = this.context.course_schedule.Include("enrollments").OrderBy(x => x.year); foreach (course_schedule sched in db_ScheduleList) { ScheduleMin tempPoco = new ScheduleMin(); tempPoco.Year = sched.year.ToString(); tempPoco.Quarter = sched.quarter; if (sched.enrollments.Where(x => x.student_id == id).Count() > 0) { pocoScheduleList.Add(tempPoco); } } } catch (Exception e) { errors.Add("Error occured in ScheduleRepository.GetAllSchedules: " + e); } return pocoScheduleList; }