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

            using (var context = new UrlShortenerContext(_connectionString))
            {
                context.Users.Add(user);
                context.SaveChanges();
            }
        }