public ActionResult Create([Bind(Include = "ID,UserId,Weight,Activity,SexType,DateTime,Notification,TargetType,NumberOfWeeks,Height,Age")] BmrCalculator bmrCalculator) { if (ModelState.IsValid) { RandomUtils randomUtils = new RandomUtils(); int sexTypeBonus = randomUtils.SexBasedBonusCalories(bmrCalculator.SexType); double activityMuptilier = randomUtils.ActivityMultiplier(bmrCalculator.Activity); double weight = bmrCalculator.Weight; double target = randomUtils.TargetBasedBonusCalories(bmrCalculator.TargetType); var baseResult2 = (9.99 * weight + 6.25 * bmrCalculator.Height - 4.92 * bmrCalculator.Age + 50); double totalResult2 = baseResult2 * activityMuptilier + sexTypeBonus + target + 50; if (bmrCalculator.Notification == false) { return(RedirectToAction("Create", new { baseResult = baseResult2, totalResult = totalResult2 })); } else { string strCurrentUserId = User.Identity.GetUserId(); bmrCalculator.UserId = strCurrentUserId; bmrCalculator.DateTime = DateTime.Now; bmrCalculator.BaseCalories = totalResult2; db.BmrCalculators.Add(bmrCalculator); db.SaveChanges(); return(RedirectToAction("Create", new { baseResult = baseResult2, totalResult = totalResult2 })); } } return(View(bmrCalculator)); }