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