Esempio n. 1
0
        public async Task <GetNotesNoteModel> GetNotesAsync(string noteId = null)
        {
            GetNotesNoteModel response = new GetNotesNoteModel();

            if (noteId is null)
            {
                var items = await _homeRepository.GetAllAsync();

                response.Items = _mapper.Map <IEnumerable <GetNotesHomeModelItem> >(items);
            }
            if (!(noteId is null))
            {
                var item = await _homeRepository.GetByIdAsync(noteId);

                response.Items = new List <GetNotesHomeModelItem>();
                response.Items = Enumerable.Append(response.Items, _mapper.Map <GetNotesHomeModelItem>(item));
            }

            return(response);
        }
Esempio n. 2
0
        public async Task <IEnumerable <NoteDto> > GetAllNotesAsync()
        {
            var noteModels = await _noteRepository.GetAllAsync();

            return(await ConvertToNoteDtos(noteModels));
        }