public int SaveToDo(ToDoItem toDoItem) { lock (locker) { if (toDoItem.ID != 0) { database.Update(toDoItem); return toDoItem.ID; } else { return database.Insert(toDoItem); } } }
public void AddTask(string todo, string priority, DateTime dueDate, int hour, int minute, int second, int updateID, bool isDeleted) { var newToDo = new ToDoItem { TaskName = todo, Priority = priority, DueDate = SetDueDate(dueDate, hour, minute, second), IsDeleted = isDeleted, ID = updateID }; App.Database.SaveToDo(newToDo); }