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)); }
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(); }
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); }
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(); }