Exemplo n.º 1
0
 public void AddTask(Task task)
 {
     using (var context = new TasksDataContext(_connectionString))
     {
         context.Tasks.InsertOnSubmit(task);
         context.SubmitChanges();
     }
 }
Exemplo n.º 2
0
        public void AddUser(User user, string password)
        {
            string passwordSalt = PasswordHelper.GenerateSalt();
            string passwordHash = PasswordHelper.HashPassword(password, passwordSalt);

            user.PasswordSalt = passwordSalt;
            user.PasswordHash = passwordHash;
            using (var context = new TasksDataContext(_connectionString))
            {
                context.Users.InsertOnSubmit(user);
                context.SubmitChanges();
            }
        }