Ejemplo n.º 1
0
    public IEnumerator createAnswer(int level)
    {
        yield return(questionManager.CreateQuestion(level));

        //生成完问题后,可以揭秘
        demystifyChange();
    }
Ejemplo n.º 2
0
 [HttpPost] // post nozīmē datu iesūtīšana
 public ActionResult ShowQuestion(QuestionModel model)
 {
     if (ModelState.IsValid) // iebūvēta funkcija, kas pārbauda vai dati atbilst definētajiem
     {
         QuestionManager.CreateQuestion(model.ToData());
     }
     return(RedirectToAction("ShowQuestion", "Question", new { id = model.Id }));
 }
Ejemplo n.º 3
0
        public IHttpActionResult AddQuestion([FromBody] QuestionDTO Request)
        {
            QuestionManager questionM = new QuestionManager();
            bool            isExist   = questionM.ExistingQuestion(Request.QuestionString);

            if (isExist == false)
            {
                questionM.CreateQuestion(Request.QuestionString);
                return(Ok("Succesfully Added"));
            }
            else
            {
                return(Content(HttpStatusCode.Conflict, "Question already exists"));
            }
        }
Ejemplo n.º 4
0
 public ActionResult CreateQuestion(QuestionModel model)
 {
     QuestionManager.CreateQuestion(model.ToData());
     model = new QuestionModel();
     return(RedirectToAction("CreateQuestion", "Question", new { id = model.Id }));
 }