public FinalGradeDto CreateFinalGrade(FinalGradeDto finalGradeDto) { var taking = db.TakingsRepository.Get(t => t.StudentId == finalGradeDto.StudentId && t.Program.ClassRoomId == finalGradeDto.ClassRoomId && t.Program.Teaching.CourseId == finalGradeDto.CourseId && t.Program.Teaching.TeacherId == finalGradeDto.TeacherId).FirstOrDefault(); if (taking == null) { return(null); } // no logging for now FinalGrade createdGrade = new FinalGrade { Assigned = finalGradeDto.AssignmentDate, GradePoint = finalGradeDto.FinalGradePoint, Notes = finalGradeDto.Notes, SchoolTerm = finalGradeDto.Semester, Taking = taking }; db.FinalGradesRepository.Insert(createdGrade); db.Save(); // for now return(Converters.FinalGradesConverter.FinalGradeToFinalGradeDto(createdGrade)); }
public IEnumerable <FinalGradeDto> GetAllByCourseId(Guid courseId) { var profStuds = _repository.GetAll <ProfStuds>(); foreach (var profStud in profStuds) { var students = _repository.GetAllByFilter <Student>(x => x.GroupId == profStud.GroupId); foreach (var student in students) { ComputeFinalGrade(profStud.CourseId, student.Id); } } var gradeDtos = new List <FinalGradeDto>(); var grades = _repository.GetAllByFilter <FinalGrade>(x => x.CourseId == courseId); foreach (var grade in grades) { var finalGrade = new FinalGradeDto { Value = grade.Value }; if (finalGrade.Value > 0) { gradeDtos.Add(finalGrade); } } return(gradeDtos); }
private void UpdateFinalGrade(Guid courseId, Guid studentId, double value) { var finalGradeDto = new FinalGradeDto { CourseId = courseId, StudentId = studentId, Value = value }; Update(finalGradeDto); }
public FinalGrade Update(FinalGradeDto finalGradeDto) { var finalGrade = _repository.GetByFilter <FinalGrade>(x => x.StudentId == finalGradeDto.StudentId && x.CourseId == finalGradeDto.CourseId); if (finalGrade == null) { return(null); } finalGrade.Value = finalGradeDto.Value; _repository.Update(finalGrade); _repository.Save(); return(finalGrade); }
public IHttpActionResult CreateFinalGrade(FinalGradeDto finalGradeDto) { var userData = IdentityHelper.GetLoggedInUser(RequestContext); logger.Info("Create Final Grade {@finalGradeDto} by {@userData}", finalGradeDto, userData); var result = service.CreateFinalGrade(finalGradeDto); if (result == null) { return(NotFound()); } logger.Info("Created Final Grade {@finalGradeId}", result.FinalGradeId); return(Ok(result)); }
public FinalGradeDto UpdateFinalGrade(int finalGradeId, FinalGradeDto finalGradeDto) { throw new NotImplementedException(); }