public ActionResult Register(TBLCustomer User) { BMI bmi = new BMI(); // try //{ if (ModelState.IsValid) { if (User.Height != null && User.Weight != null) { User.BMI = bmi.CalculateBMI(User.Height, User.Weight); } else { User.BMI = 0; } Object.TBLCustomers.Add(User); Object.SaveChanges(); TempData["msg"] = "Registration Successfully"; return(View()); } else { return(View()); } // } // catch (Exception e) //{ //TempData["msg"] = "Registration failed " + e.Message; // return RedirectToAction("Register"); // } }
public void SaveInTemp(ref List <TBLExercise> Data, ref DAERSEntities db, ref TBLTemp temp, int j) { var a = new TBLExercise(); if (Data.Count >= 2) { a = Data[random.Next(0, Data.Count - 1)]; } else { a = Data[Data.Count - 1]; } SetData(ref temp, ref a, j); db.TBLTemps.Add(temp); db.SaveChanges(); }//save in temp table