public SpecNoteResult AddSpecialNote(SpecialNoteDto dto) { var specnoteEntity = dto.ToEntity(); var userProfile = _userProfileRepository.Get(x => x.UserLogin == dto.UserLogin); specnoteEntity.UserProfileId = userProfile != null ? userProfile.Id : (int?)null; _specialNoteRepository.UpdateAndCommit(specnoteEntity); _activityHelperService.CreateAddedSpecialNoteActivity(specnoteEntity); return new SpecNoteResult { Id = specnoteEntity.Id, UserAlias = specnoteEntity.ToDto().UserAlias, Update = specnoteEntity.LastEdited }; }
public static SpecialNoteDto ToDto(this SpecialNote specialNote) { var specialNotesDto = new SpecialNoteDto { Id = specialNote.Id, UserLogin = specialNote.UserProfile != null ? specialNote.UserProfile.UserLogin : "", Text = specialNote.Text, LastEdited = specialNote.LastEdited, CandidateId = specialNote.CandidateId, VacancyId = specialNote.VacancyId, UserAlias = specialNote.UserProfile != null ? specialNote.UserProfile.Alias : "" }; return specialNotesDto; }