public void AddPoint(DoneIt doneit, decimal before, decimal after)
 {
     Debug.WriteLine(" - adding {0} and {1} at {2}", before, after, doneit.Date.ToShortDateString());
     // Add point just before
     Points.Add(new GraphPoint { Time = doneit.Date, Amount = 0, y = before });
     // Add point after
     Points.Add(new GraphPoint { Time = doneit.Date.AddSeconds(1), Amount = doneit.Amount, y = after });
 }
        public ActionResult Create(DoneIt doneit)
        {
            if (ModelState.IsValid)
            {
                db.DoneIts.Add(doneit);
                db.SaveChanges();
                return RedirectToAction("Index", "Home"); // new { id = doneit.GoalId });
            }

            ViewBag.GoalId = new SelectList(db.Goals, "Id", "Title", doneit.GoalId);
            return View(doneit);
        }
 public ActionResult Edit(DoneIt doneit)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doneit).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Details", "Goal", new { id = doneit.GoalId });
     }
     ViewBag.GoalId = new SelectList(db.Goals, "Id", "Title", doneit.GoalId);
     return View(doneit);
 }
 //
 // GET: /DoneIt/Create
 public ActionResult Create(int? id)
 {
     var doneIt = new DoneIt { Date = DateTime.Now , Amount=1};
     ViewBag.GoalId = new SelectList(db.Goals, "Id", "Title", id);
     return View(doneIt);
 }