Exemple #1
0
        public async Task <CollaboratorResponseDto> RemoveCollaborator(int collaboratorId, int userId)
        {
            Collaborator isCollaborator = await _collaboratorRepository.GetCollaboratorByIdAsync(collaboratorId);

            if (isCollaborator == null)
            {
                throw new FundooException(ExceptionMessages.NO_SUCH_COLLABORATOR);
            }
            Note noteOwner = await _noteRepository.GetNoteByAccountAndCollaborator(userId, isCollaborator.NoteId);

            if (noteOwner == null)
            {
                throw new FundooException(ExceptionMessages.NO_SUCH_NOTE);
            }

            return(_mapper.Map <CollaboratorResponseDto>(await _collaboratorRepository.RemoveCollaborator(isCollaborator)));
        }