예제 #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);
        }
예제 #2
0
        // GET: /<controller>/
        /// <summary>
        /// Gets the <see cref="FeedingTimes"/> model for the feeding view
        /// </summary>
        /// <returns></returns>
        public IActionResult FeedingTimes()
        {
            FeedingTimes feedingTimes = _formDataService.GetFeedingTimes();

            return(View(feedingTimes));
        }