Exemplo n.º 1
0
        public void DeleteEducation(int id)
        {
            EducationProcess education = Database.EducationsRepository.FindById(id);

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

            return(subjectDTO.Name);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }