예제 #1
0
        public void DeleteEducation(int id)
        {
            EducationProcess education = Database.EducationsRepository.FindById(id);

            Database.EducationsRepository.Remove(education);
            Database.SaveChanges();
        }
예제 #2
0
        public string SetSubjectName(int idEducation)
        {
            EducationProcess education  = Database.EducationsRepository.FindById(idEducation);
            SubjectDTO       subjectDTO = GetStudentSubject(education.Id);

            return(subjectDTO.Name);
        }
예제 #3
0
        public SubjectDTO GetStudentSubject(int idEducation)
        {
            EducationProcess education = Database.EducationsRepository.FindById(idEducation);
            Subject          subject   = Database.SubjectsRepository.Get().Where(s => s.Id == education.IdSubject).FirstOrDefault();
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap <Subject, SubjectDTO>()).CreateMapper();

            return(mapper.Map <Subject, SubjectDTO>(subject));
        }
예제 #4
0
        public string SetGroupName(int idStudent)
        {
            EducationProcess education = Database.EducationsRepository.Get().Where(e => e.IdStudent == idStudent).FirstOrDefault();
            GroupDTO         groupDTO  = GetStudentGroup(education.IdStudent);

            education.GroupName = groupDTO.Name;
            return(groupDTO.Name);
        }
예제 #5
0
        public void EditEducation(EducationProcessDTO educationDTO)
        {
            IMapper          mapper    = new MapperConfiguration(cfg => cfg.CreateMap <EducationProcessDTO, EducationProcess>()).CreateMapper();
            EducationProcess education = Database.EducationsRepository.FindById(educationDTO.Id);

            education = mapper.Map <EducationProcessDTO, EducationProcess>(educationDTO);

            Database.EducationsRepository.Update(education);
            Database.SaveChanges();
        }