Пример #1
0
        public async Task <AuthorOutputDto> Get(int id)
        {
            AuthorOutputDto author = new AuthorOutputDto();
            var             result = await _authorManager.GetAsync(id);

            author = _mapper.Map <AuthorOutputDto>(result);
            return(author);
        }
        /// <summary>
        /// Return Authors list.
        /// </summary>
        /// <returns></returns>
        public AuthorOutputDto Authors()
        {
            var output = new AuthorOutputDto();

            foreach (var a in _authorRepository.GetAll())
            {
                output.AuthorDtos.Add(new AuthorDto
                {
                    Name  = a.Name,
                    Value = a.Id
                });
            }

            return(output);
        }