Example #1
0
        // GET: EnergyUsage
        public ActionResult Index(string location, string type, string timePeriod)
        {
            EnergyUsage result = new EnergyUsage();

            // gets individal energy usage in kwh and rounding it off to 2dp
            ViewBag.sum      = Math.Round(result.IndividualEnergyUsage(location, type, timePeriod), 2);
            ViewBag.location = location;

            return(View(result));
        }
        // GET: EnergyUsage
        public ActionResult Index(string location, string type, string timePeriod)
        {
            _session = Session.getInstance;

            if (_session != null)
            {
                EnergyUsage result = new EnergyUsage();

                // gets individal energy usage in kwh and rounding it off to 2dp
                ViewBag.sum      = Math.Round(result.IndividualEnergyUsage(location, type, timePeriod), 2);
                ViewBag.location = location;

                return(View(result));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }