Example #1
0
        //create a view user method for our httpGet
        public ActionResult ViewBMR()
        {
            //instantiate and name
            BMRViewModel _viewModel = new BMRViewModel();

            //use method from DAL that has stored procedure, map it to the model called playerlist
            _viewModel.BMRList = _Mapper.Map(_BMRDataAccess.ViewBMR());
            //load viewmodel into view and return the view
            return(View(_viewModel.BMRList));
        }
        public IActionResult Index(BMRViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("BMRCalculator"));
            }
            var bmr       = _mapper.Map <BMRViewModel, BMR>(model);
            var bmrResult = Calculator.BmrCalculator(bmr);

            ViewBag.Result = Convert.ToInt32(bmrResult);

            return(View("BMRCalculator"));
        }