public async Task <Question> CreateQuestion(Question newQuestion) { await _questionsRevisedContext.AddAsync(newQuestion); await _questionsRevisedContext.SaveChangesAsync(); return(newQuestion); }
public async Task <User> DeleteUser(int userId) { var userToDelete = await _questionsRevisedContext.Users.FindAsync(userId); _questionsRevisedContext.Users.Remove(userToDelete); await _questionsRevisedContext.SaveChangesAsync(); return(userToDelete); }
public async Task <User> Register(User user, string password) { byte[] passwordHash, passwordSalt; CreatePasswordHash(password, out passwordHash, out passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; await _questionsRevisedContext.Users.AddAsync(user); await _questionsRevisedContext.SaveChangesAsync(); return(user); }