public SimpleTasksController(ISimpleTaskRepository simpleTaskRepository) { _simpleTaskRepository = simpleTaskRepository; _mapperConfiguration = new MapperConfiguration(cfg => { cfg.CreateMap <SimpleTask, SimpleTaskDto>(); cfg.CreateMap <SimpleTaskDto, SimpleTask>(); cfg.CreateMap <SimpleTaskBaseDto, SimpleTask>() .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name)) .ForMember(dest => dest.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy)) .ForMember(dest => dest.Status, opt => opt.MapFrom(src => Status.Open)) .ForMember(dest => dest.CreationDateTime, opt => opt.MapFrom(src => DateTime.Now)); }); _iMapper = _mapperConfiguration.CreateMapper(); _numberOfUpsertOperations = _simpleTaskRepository.GetAll().Sum(x => x.NumberOfUpdates); _validatorService = new ValidatorService(); var taskNames = _simpleTaskRepository.GetAll().Select(x => x.Name); TheBestTaskNameCheckerInTheWorld.SyncNames(taskNames); // maybe this should be a singleton...? if (_tasksInProgress == null) { _tasksInProgress = new HashSet <string>(); } }
public SimpleTaskLiteController(ISimpleTaskRepository simpleTaskRepository) { _simpleTaskRepository = simpleTaskRepository; // something's wrong here, can't tell what exactly... need to create a bug :P //_mapperConfiguration = new MapperConfiguration(cfg => //{ // cfg.CreateMap<SimpleTask, SimpleTaskLiteDto>() // .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name)) // .ForMember(dest => dest.NumberOfUpdates, opt => opt.MapFrom(src => src.NumberOfUpdates)); //}); }