public void Add(Url url) { using (var context = new UrlShortenerDataContext(_connectionString)) { context.Urls.InsertOnSubmit(url); context.SubmitChanges(); } }
public void AddUser(User user, string password) { string salt = PasswordHelper.GenerateSalt(); string passwordHash = PasswordHelper.HashPassword(password, salt); user.PasswordSalt = salt; user.PasswordHash = passwordHash; using (var context = new UrlShortenerDataContext(_connectionstring)) { context.Users.InsertOnSubmit(user); context.SubmitChanges(); } }