public ActionResult ConfirmEdit(ProjectViewModel model)
 {
     if (ModelState.IsValid)
     {
         model.Edit(_db);
         return Json(new { Success = true });    
     }
     return Json(new {Success = false });
 }
        public ActionResult GetSubTasks(ProjectViewModel project = null)
        {
            var subTasks = _db.SubTasks.ToList();

            if (project == null)
            {
                return Json(subTasks, JsonRequestBehavior.AllowGet);
            }
            var result = subTasks.Where(st => st.SubTaskId == project.ProjectID);

            return Json(result, JsonRequestBehavior.AllowGet);
        }
        public ActionResult ConfirmDelete(ProjectViewModel model)
       {
           var project = _db.Projects.Find(model.ProjectID);

            if (ModelState.IsValid)
            {
                _db.Projects.Remove(project);
                _db.SaveChanges();
            }
            return Json(new {Success = true});

           // Delete will also have to recursively delete all related subtask records since we don't want to rely on the database to do that.
           // Or not.  Do I need to care about if I may (though i AM planning on) move to a different storage engine?  Possibly RavenDB.
           // Either way Subtasks are currently being orphaned in the database and that needs to be corrected one way or another.
           // With the understanding that THAT specific logic would absolutely not live in the controller
        }
 public ActionResult Delete(ProjectViewModel model)
 {
     return GetProjectJson(model.ProjectID);
 }