コード例 #1
0
        public GetAuthorResponseModel GetAuthorResponseModel(int id)
        {
            var authorInBookRepo = new AuthorInBookRepository(dapperConnectionFactory);

            Author author = base.Get(id);
            IEnumerable <AuthorInBook> ainbList = authorInBookRepo.GetByAuthorId(id);
            GetAuthorResponseModel     response = new GetAuthorResponseModel
            {
                DateOfBirth = author.DateOfBirth,
                DateOfDeath = author.DateOfDeath,
                FirstName   = author.FirstName,
                Id          = author.Id,
                Patronymic  = author.Patronymic,
                SecondName  = author.SecondName,
                Books       = authorInBookRepo.GetAuthorInBookResponseModelByAuthorId(author.Id)
            };

            return(response);
        }
コード例 #2
0
ファイル: AuthorService.cs プロジェクト: Burakovivan/PubLibIS
        public AuthorViewModel GetAuthorViewModel(int id)
        {
            GetAuthorResponseModel author = db.Authors.GetAuthorResponseModel(id);

            return(mapper.Map <GetAuthorResponseModel, AuthorViewModel>(author));
        }