public IActionResult Post([FromBody] QuizLibrary.Question question) { NewQuiz = new QuizManager(); if (!ModelState.IsValid) { return(BadRequest()); } NewQuiz.AddQuestion(question); return(Ok(question.Question_statement)); }
public IActionResult Get(String id) { NewQuiz = new QuizManager(); QuizLibrary.Question GotQuestion = NewQuiz.GetQuestionById(id); if (GotQuestion == null) { return(NotFound()); } return(Ok(GotQuestion)); }
public IActionResult Put(JObject jObject) { NewQuiz = new QuizManager(); if (!ModelState.IsValid) { return(BadRequest()); } dynamic json = jObject; //Question question = json.question.ToObject<Question>(); //string new_ques = json.new_ques; QuizLibrary.Question new_ques = json.ToObject <QuizLibrary.Question>(); //int index = json.index; if (NewQuiz.UpdateQuestion(new_ques)) { Console.WriteLine("success"); } return(Ok()); }