public ActionResult SetDone(int?id, bool TaskDone) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var task = db.Tasks.Find(id); if (task == null) { return(HttpNotFound()); } //we got an id, and it maps to an actual task object! task.TaskDone = TaskDone; db.SaveChanges(); return(RedirectToAction("Index")); }
public static int Create(string catName) { var db = new To_Do_ListContext(); var category = new Category { Name = catName }; db.Category.Add(category); db.SaveChanges(); return(1); }