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); }
public AuthorViewModel GetAuthorViewModel(int id) { GetAuthorResponseModel author = db.Authors.GetAuthorResponseModel(id); return(mapper.Map <GetAuthorResponseModel, AuthorViewModel>(author)); }