Exemplo n.º 1
0
        public async Task <NoteDto> CreateAsync(NoteDto noteDto)
        {
            var note = new Note
            {
                Date        = noteDto.Date,
                Description = noteDto.Description
            };

            if (noteDto.Photos.Any())
            {
                var photos = ConvertToPhotoModels(noteDto.Photos);
                note.FilesIds = (await _photoRepository.CreatePhotos(photos)).ToList();
            }
            var result = await _noteRepository.CreateNoteAsync(note);

            return(await ConvertToNoteDto(result));
        }