public void AddUserLikeJoke(UserLikeJoke likeJoke) { using (var ctx = new JokesContext(_connectionString)) { ctx.LikeJokes.Add(likeJoke); ctx.SaveChanges(); } }
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(); } }
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(); } }