Exemple #1
0
        public async Task <ActionResult> CreateFlightSetting(FlightSetting flightSetting)
        {
            // Search in the database for the meteorology, visibility and setoff values registered by the user
            Meteorology flightMeteorology = await _db.Meteorologies.FindAsync(double.Parse(Request.Form["flightSettingMeteorology"]));

            Visibility flightVisibility = await _db.Visibilities.FindAsync(double.Parse(Request.Form["flightSettingVisibility"]));

            Setoff flightSetoff = await _db.Setoffs.FindAsync(double.Parse(Request.Form["flightSettingSetoff"]));

            // Set the meteorology, visibily, setoff and setting score values of the flight setting
            flightSetting.FlightSettingMeteorology = flightMeteorology;
            flightSetting.FlightSettingVisibility  = flightVisibility;
            flightSetting.FlightSettingSetoff      = flightSetoff;
            flightSetting.calculateFlightSettingScore();

            // Save changes in local memory
            var result = await _db.FlightSettings.AddAsync(flightSetting);

            // Save the changes in the database
            _db.SaveChanges();

            return(RedirectToAction("index", "home"));
        }
Exemple #2
0
        public FlightSetting(Meteorology FlightSettingMeteorology, Visibility FlightSettingVisibility, Setoff FlightSettingSetoff)
        {
            this.FlightSettingMeteorology = FlightSettingMeteorology;
            this.FlightSettingVisibility  = FlightSettingVisibility;
            this.FlightSettingSetoff      = FlightSettingSetoff;

            double tempToTalScore = (FlightSettingVisibility.Score + FlightSettingMeteorology.Score + FlightSettingSetoff.Score) / 3;

            TotalScore = System.Math.Round(tempToTalScore, 2);
        }