public void AddTask(string title) { using (var context = new TasksRepositoryDataContext(_connectionString)) { Task task = new Task { Title = title, Completed = false }; context.Tasks.InsertOnSubmit(task); context.SubmitChanges(); } }
public void AddUser(User user, string password) { var salt = PasswordHelper.GenerateSalt(); var hash = PasswordHelper.HashPassword(password, salt); user.PasswordHash = hash; user.PasswordSalt = salt; using (var context = new TasksRepositoryDataContext(_connectionString)) { context.Users.InsertOnSubmit(user); context.SubmitChanges(); } }