示例#1
0
        public Grade GetCatalogueGrade(int id, int schoolId, int catalogueId)
        {
            Domain.Grade grade = _context.Grades.Include(g => g.Student).Include(g => g.Course)
                                 .Include(g => g.Course.Subject)
                                 .Include(g => g.Mentor).Where(g => g.CatalogueId == catalogueId)
                                 .FirstOrDefault(g => g.Id == id);

            return(_mapper.Map <Grade>(grade));
        }
示例#2
0
        public void UpdateCatalogueGrade(Grade grade, GradeDTO gradeDTO, int schoolId)
        {
            Domain.Grade updateGrade = _context.Grades.FirstOrDefault(g => g.Id == grade.Id);
            updateGrade.StudentId = gradeDTO.StudentId;
            updateGrade.Mark      = gradeDTO.Mark;
            updateGrade.CourseId  = gradeDTO.CourseId;
            updateGrade.MentorId  = gradeDTO.MentorId;
            updateGrade.Date      = gradeDTO.Date;

            _context.SaveChanges();
        }
示例#3
0
        public Grade AddCatalogueGrade(Grade grade, int schoolId, int catalogueId)
        {
            Domain.Grade newGrade = new Domain.Grade()
            {
                StudentId   = grade.Student.Id,
                Mark        = grade.Mark,
                MentorId    = grade.Mentor.Id,
                Date        = grade.Date,
                CourseId    = grade.Course.Id,
                CatalogueId = catalogueId
            };
            _context.Grades.Add(newGrade);
            _context.SaveChanges();

            return(grade);
        }
示例#4
0
 public void DeleteCatalogueGrade(Grade grade, int schoolId, int catalogueId)
 {
     Domain.Grade deleteGrade = _context.Grades.FirstOrDefault(g => g.Id == grade.Id);
     _context.Grades.Remove(deleteGrade);
     _context.SaveChanges();
 }