public void DeleteEducation(int id) { EducationProcess education = Database.EducationsRepository.FindById(id); Database.EducationsRepository.Remove(education); Database.SaveChanges(); }
public string SetSubjectName(int idEducation) { EducationProcess education = Database.EducationsRepository.FindById(idEducation); SubjectDTO subjectDTO = GetStudentSubject(education.Id); return(subjectDTO.Name); }
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)); }
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); }
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(); }