public bool Delete(int id) { var professor = _repository.FindById(id); _repository.Delete(professor); return(_repository.SaveChanges()); }
public async Task Update(int id, UpdateSectionDto section) { var sec = await _sectionRepository.FindById(id); var prof = await _professorRepository.FindById(section.Professor); var per = await _periodRepository.FindById(section.Period); var cla = await _classRepository.FindById(section.Class); var studentIds = _studentRepository.Filter(x => section.Students.Contains(x.Account)).Select(x => x.Id); sec.Professor = prof; sec.Period = per; sec.Class = cla; sec.Code = section.Code; await _sectionRepository.Update(sec.StudentSections, studentIds.Select(x => new StudentSection { StudentId = x, SectionId = id }), x => x.StudentId); }
public async Task Remove(int id) { var professor = await _professorRepository.FindById(id); await _professorRepository.Disable(professor); }
public Professor GetById(int id) { return(_professorRepository.FindById(id, a => a.Curso)); }