示例#1
0
 public void AddUserLikeJoke(UserLikeJoke likeJoke)
 {
     using (var ctx = new JokesContext(_connectionString))
     {
         ctx.LikeJokes.Add(likeJoke);
         ctx.SaveChanges();
     }
 }
示例#2
0
 public void AddUser(User user, string password)
 {
     user.PasswordHash = BCrypt.Net.BCrypt.HashPassword(password);
     using (var ctx = new JokesContext(_connectionString))
     {
         ctx.Users.Add(user);
         ctx.SaveChanges();
     }
 }
示例#3
0
 public void AddJoke(Joke joke)
 {
     joke.JokeDataId = (int)joke.Id;
     joke.Id         = null;
     using (var ctx = new JokesContext(_connectionString))
     {
         ctx.Jokes.Add(joke);
         ctx.SaveChanges();
     }
 }