public bool Update(Task t) { using (var c = connection()) { c.Execute("UPDATE Tasks SET isComplete = @isComplete, title = @title WHERE id = @id", t); onTasksUpdated(); return true; } }
public Task Add(Task t) { using (var c = connection()) { c.Execute("INSERT INTO Tasks (isComplete, title) VALUES (@isComplete, @title)", t); onTasksUpdated(); return t; } }
public Task Add(Task t) { using (var context = new TaskContext()) { context.Tasks.Add(t); context.SaveChanges(); onTasksUpdated(); return t; } }
public bool Update(Task t) { using (var context = new TaskContext()) { context.Tasks.Attach(t); context.Entry(t).State = System.Data.EntityState.Modified; context.SaveChanges(); onTasksUpdated(); return true; } }
public bool Update(Task t) { Task update = tasks.Where(t2 => t2.id == t.id).FirstOrDefault(); if (update == null) return false; tasks.Insert(tasks.IndexOf(update) + 1, t); tasks.Remove(update); onTasksUpdated(); return true; }
public bool PutTask(Task t) { return repository.Update(t); }
public Task PostTask(Task t) { return repository.Add(t); }
public Task Add(Task t) { tasks.Add(t); onTasksUpdated(); return t; }