// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSingleton <IConfiguration>(Configuration); var section = Configuration.GetSection("ProfilesConfig").Get <ProfilesConfiguration>(); var imagesService = new ColorProfilesService(section); services.AddSingleton <ColorProfilesService>(imagesService); }
public void Startup() { _redProfile = new ColorProfile { Name = "red", R = 255, G = 0, B = 0 }; _greenProfile = new ColorProfile { Name = "green", R = 60, G = 170, B = 20 }; var config = new ProfilesConfiguration { Tolerance = 20, Profiles = new ColorProfile[] { _redProfile, _greenProfile } }; _service = new ColorProfilesService(config); }
public ColorProfilesController(ColorProfilesService imagesService) { _colorProfilesService = imagesService; }