/// <summary> /// Create Question Async /// </summary> /// <param name="question"></param> /// <returns></returns> public async Task <QuestionModel> CreateQuestionsAsync(QuestionModel question) { await _quizAppDbContext.Questions.AddAsync(question); await _quizAppDbContext.SaveChangesAsync(); return(question); }
public async Task <ActionResult <qa_users> > PostUserInfo(qa_users userInfo) { if (await IsLoginUniqueAsync(Convert.ToChar(userInfo.qa_users_login))) { _context.Qa_users.Add(userInfo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetUsersInfo", userInfo, null)); } else { return(NotFound()); } }
public async Task <ActionResult <qa_questions> > PostClassInfo(qa_class classInfo) { _context.Qa_class.Add(classInfo); await _context.SaveChangesAsync(); //return CreatedAtAction(nameof(GetStudentInfo), new //{ // qa_users_name = studentInfo.qa_users_name, // qa_users_pass = studentInfo.qa_users_pass, // qa_users_email = studentInfo.qa_users_email, // qa_users_score = studentInfo.qa_users_score //}, studentInfo); return(CreatedAtAction("GetClassesInfo", classInfo, null)); }
/// <summary> /// Create Quiz Async /// </summary> /// <param name="quiz"></param> /// <returns></returns> public async Task <QuizModel> CreateQuizAsync(QuizModel quiz) { await _quizAppDbContext.Quizzes.AddAsync(quiz); await _quizAppDbContext.SaveChangesAsync(); return(quiz); }
/// <summary> /// Register Async /// </summary> /// <param name="user"></param> /// <param name="password"></param> /// <returns></returns> public async Task <UserModel> RegisterAsync(UserModel user, string password) { byte[] passwordHash, passwordSalt; CreatePasswordHash(password, out passwordHash, out passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; await _quizAppDbContext.AddAsync(user); await _quizAppDbContext.SaveChangesAsync(); return(user); }