public void Add(ShortenedUrl url) { using (var context = new UrlShortenerContext(_connectionString)) { context.ShortenedUrls.Add(url); context.SaveChanges(); } }
public void AddUser(User user, string password) { user.PasswordHash = PasswordHelper.HashPassword(password); using (var context = new UrlShortenerContext(_connectionString)) { context.Users.Add(user); context.SaveChanges(); } }