Пример #1
0
        public ActionResult Create(Task task)
        {
            var db = new DataContext();

            db.Tasks.Add(task);
            db.SaveChanges();

            return RedirectToAction("Index");
        }
Пример #2
0
        public ActionResult Edit(Task task)
        {
            var db = new DataContext();
            var taskOld = db.Tasks.Single(t => t.Id == task.Id);

            taskOld.Name = task.Name;
            taskOld.Done = task.Done;

            db.SaveChanges();
            return RedirectToAction("Index");
        }