public BookBusinessLogic(IDataSourceConnectionService dataSourceConnection)
        {
            _dataSourceConnection = dataSourceConnection;

            var bookRetrieverConfig = new MapperConfiguration(m =>
            {
                m.CreateMap <Book, BusinessBook>()
                .ForMember(dest => dest.Price, map => map.MapFrom(x => x.Pages * 0.10))
                .ForMember(dest => dest.BookAdvertisement, map => map.MapFrom(x => $"'{x.Name}' written by {x.Author} on {x.ReleaseDate} [{x.Category}]"));
            });

            bookRetriever = bookRetrieverConfig.CreateMapper();

            var bookSenderConfig = new MapperConfiguration(m =>
            {
                m.CreateMap <BusinessBook, Book>();
            });

            bookSender = bookSenderConfig.CreateMapper();
        }
Example #2
0
 public Program(IBusinessLogicService business, IDataSourceConnectionService dataSource, IPresentationService presentation)
 {
     Business     = business;
     DataSource   = dataSource;
     Presentation = presentation;
 }
 public DataSourceController(IDataSourceConnectionService datasourceconnectionService)
 {
     this._datasourceconnectionService = datasourceconnectionService;
 }