示例#1
0
 public ActionResult Weight(WeightModel model)
 {
     if (model.BodyWeight == 0)
     {
         TempData["Error"] = "Please provide your body weight";
         return(RedirectToAction("../Main/Home"));
     }
     try {
         Body b = new Body(this.db, this.user);
         b.AddBodyWeight(model.BodyWeight);
         this.user.Measurements.BodyWeight = model.BodyWeight;
         TempData["Status"] = "Body weight successfully recorded";
     } catch {
         TempData["Error"] = "Unable to record body weight - Please try again later";
     }
     return(RedirectToAction("../Main/Home"));
 }