public async Task <OperationDatails> CreateTeacherProfileAsync(TeacherProfileDTO teacherProfileDTO) { if (teacherProfileDTO == null) { throw new ServiceException("TeacherProfile is NULL!", false); } teacherProfileDTO.ActiveProfile = false; _database.teacherProfileRepository.Create(_mapper.Map <TeacherProfile>(teacherProfileDTO)); await _database.SaveAsync(); return(new OperationDatails("TeacherProfile is Create", true)); }
public async Task <OperationDatails> EditTeacherProfileAsync(TeacherProfileDTO teacherProfileDTO) { if (teacherProfileDTO == null) { throw new ServiceException("teacherUserProfile is null", false); } var teacherProfile = await _database.teacherProfileRepository.GetByIdAsync(teacherProfileDTO.TeacherProfileId); if (teacherProfile == null) { throw new ServiceException("Teacher with this Id is not found!", false); } if (teacherProfile.ActiveProfile == false) { return(new OperationDatails("not activated", false)); } _database.teacherProfileRepository.Update(_mapper.Map(teacherProfileDTO, teacherProfile)); await _database.SaveAsync(); return(new OperationDatails("User data is updated!", true)); }