public MeasurementViewModel() {
     CaptureMeasurement = new ChildMeasurement();
 }
        public ActionResult EditMeasurement(ChildMeasurement measure)
        {
            ViewBag.CurrentPage = "Children";
            try
            {
                var fromDB = db.ChildMeasurements.FirstOrDefault(x => x.Id == measure.Id);
                fromDB.HeadCircumference = measure.HeadCircumference;
                fromDB.Height = measure.Height;
                fromDB.Weight = measure.Weight;
                db.SaveChanges();

                return  RedirectToAction("CreateMeasurement", new {id = fromDB.ChildID});
            }
            catch (Exception ex)
            {
                return RedirectToAction("Index");
            }
        }
 public ActionResult DeleteMeasurement(ChildMeasurement measure)
 {
    
     ViewBag.CurrentPage = "Children";
     var measurement = db.ChildMeasurements.FirstOrDefault(x => x.Id == measure.Id);
     if (measurement == null)
     {
         return HttpNotFound();
     }
     string myID = measurement.ChildID;
     db.ChildMeasurements.Remove(measurement);
     db.SaveChanges();
     return RedirectToAction("CreateMeasurement", new { id = myID });
 }
        public ActionResult AddMeasurements(ChildMeasurement measure)
        {
            ViewBag.CurrentPage = "Children";
            try
            {
                Child child = _childService.GetChildForSession(User.Identity.Name);
                measure.ChildID = child.IdNumber;
                measure.Created = DateTime.Now;

                db.ChildMeasurements.Add(measure);
                db.SaveChanges();

                return RedirectToAction("AddParent", child);
            }
            catch (Exception ex)
            {
                return RedirectToAction("Index");
            }
        }