Beispiel #1
0
        /// <summary>
        /// Creates a new <see cref="Startup"/> object
        /// </summary>
        /// <param name="env"></param>
        public Startup(IHostingEnvironment env)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(env.ContentRootPath)
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                                            .AddEnvironmentVariables();

            Configuration = builder.Build();

            _formDataService = new FormDataService();

            FeedingTimes feedingTimes = _formDataService.GetFeedingTimes();

            _pinController = new AquaPinController(feedingTimes.Feedings, feedingTimes.Pinches);

            TankSpecs tankSpecs = _formDataService.GetTankSpecs();

            _i2CController       = new AquaI2CController(tankSpecs.Width, tankSpecs.Height, tankSpecs.Depth);
            _pinMasterController = new PinMasterController(_i2CController, _pinController, tankSpecs.WaterChangeTime);
        }
        // GET: /<controller>/
        /// <summary>
        /// Gets the <see cref="TankSpecs"/> model for the tank view
        /// </summary>
        /// <returns></returns>
        public IActionResult TankSpecs()
        {
            TankSpecs tankSpecs = _formDataService.GetTankSpecs();

            return(View(tankSpecs));
        }