public List <ModuleAssessment> GetData() { using (var context = new STUDENT_GRADE_MANGEREntities()) { return(context.ModuleAssessment.ToList()); } }
public List <CourseModule> GetCourseModules() { using (var context = new STUDENT_GRADE_MANGEREntities()) { return(context.CourseModule.ToList()); } }
public List <Result> GetData() { using (var context = new STUDENT_GRADE_MANGEREntities()) { return(context.Result.ToList()); } }
public List <CourseModule> GetModulesByCourse(Course m) { using (var context = new STUDENT_GRADE_MANGEREntities()) { return(context.CourseModule.Where(a => a.Course.CourseID.Equals(m.CourseID)).ToList()); } }
public int SaveResult(Result r) { r.CreatedDate = DateTime.Now; r.UpdatedDate = DateTime.Now; using (var context = new STUDENT_GRADE_MANGEREntities()) { context.Result.Add(r); return(context.SaveChanges()); } }
public List <ModuleAssessment> GetAssesmentsByModule(CourseModule c) { if (c != null) { using (var context = new STUDENT_GRADE_MANGEREntities()) { return(context.ModuleAssessment.Where(a => a.CourseModule.CourseModuleID.Equals(c.CourseModuleID)).ToList()); } } return(new List <ModuleAssessment>()); }
public Student GetStudentById(Guid studentId) { try { using (var context = new STUDENT_GRADE_MANGEREntities()) { var student = context.Student.Where(st => st.StudentID == studentId) .FirstOrDefault(); return(student); } } catch (Exception ex) { Console.Write(ex); return(null); } }
public int SaveAssessment(ModuleAssessment r) { r.CreatedDate = DateTime.Now; r.UpdatedDate = DateTime.Now; try { using (var context = new STUDENT_GRADE_MANGEREntities()) { context.ModuleAssessment.Add(r); return(context.SaveChanges()); } } catch (Exception ex) { Console.Write(ex); return(0); } }
public int SaveCourseModule(CourseModule m) { m.CreatedDate = DateTime.Now; m.UpdatedDate = DateTime.Now; try { using (var context = new STUDENT_GRADE_MANGEREntities()) { context.CourseModule.Add(m); return(context.SaveChanges()); } } catch (Exception ex) { Console.Write(ex); return(0); } }
public int SaveStudent(Student student) { student.CreatedDate = DateTime.Now; student.UpdatedDate = DateTime.Now; try { using (var context = new STUDENT_GRADE_MANGEREntities()) { context.Student.Add(student); return(context.SaveChanges()); } } catch (Exception ex) { Console.Write(ex); return(0); } }
public List <CourseDTO> GetStudentEnrolledCourses(Guid studentId) { AutoMapper.Mapper.Initialize(cfg => cfg.AddProfile <AutoMapperProfile>()); try { using (var context = new STUDENT_GRADE_MANGEREntities()) { var studentCourses = context.Course.Where(st => st.StudentID == studentId) .ProjectTo <CourseDTO>() .ToList(); return(studentCourses); } } catch (Exception ex) { Console.Write(ex); return(null); } }
public StudentDTO StudentLoginValidate(string userName, string password) { AutoMapper.Mapper.Initialize(cfg => cfg.AddProfile <AutoMapperProfile>()); try { using (var context = new STUDENT_GRADE_MANGEREntities()) { var student = context.Student.Where(st => string.Equals(st.UserName, userName) && string.Equals(st.Password, password)) .ProjectTo <StudentDTO>() .FirstOrDefault(); return(student); } } catch (Exception ex) { Console.Write(ex); return(null); } }
public List <CourseModuleDTO> GetModulesByCourseAndLevel(Guid courseId, int moduleLevel) { AutoMapper.Mapper.Initialize(cfg => cfg.AddProfile <AutoMapperProfile>()); try { using (var context = new STUDENT_GRADE_MANGEREntities()) { return(context.CourseModule. Where(a => a.Course.CourseID.Equals(courseId) && a.Level == moduleLevel) .ProjectTo <CourseModuleDTO>() .ToList()); } } catch (Exception ex) { Console.Write(ex); return(null); } }