public Question(QuizTable Q) { QuestionText = Q.QuestionText; ChoiceA = Q.ChoiceA; ChoiceB = Q.ChoiceB; ChoiceC = Q.ChoiceC; ChoiceD = Q.ChoiceD; CorrectAnswer = Q.CorrectAnswer; /* * var RNG = rnd.Next(3); * * switch (RNG) * { * case 0: * CorrectAnswer = "A"; * ChoiceA = "En elegant firre"; * break; * case 1: * CorrectAnswer = "B"; * ChoiceB = "En elegant firre"; * break; * case 2: * CorrectAnswer = "C"; * ChoiceC = "En elegant firre"; * break; * case 3: * CorrectAnswer = "D"; * ChoiceD = "En elegant firre"; * break; * } */ }
public ActionResult DeleteConfirmed(int id) { QuizTable quizTable = db.QuizTables.Find(id); db.QuizTables.Remove(quizTable); db.SaveChanges(); return(RedirectToAction("Index")); }
public Question(QuizTable Q) { QuestionText = Q.QuestionText; ChoiceA = Q.ChoiceA; ChoiceB = Q.ChoiceB; ChoiceC = Q.ChoiceC; ChoiceD = Q.ChoiceD; CorrectAnswer = Q.CorrectAnswer; }
public ActionResult Edit([Bind(Include = "quizID,quizName,quizDescription")] QuizTable quizTable) { if (ModelState.IsValid) { db.Entry(quizTable).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(quizTable)); }
public ActionResult Create([Bind(Include = "quizID,quizName,quizDescription")] QuizTable quizTable) { if (ModelState.IsValid) { db.QuizTables.Add(quizTable); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(quizTable)); }
// GET: QuizTables/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } QuizTable quizTable = db.QuizTables.Find(id); if (quizTable == null) { return(HttpNotFound()); } return(View(quizTable)); }
public async void SubmitQ(object sender, EventArgs e) { if (CorAnsw != "" && Categ != "") { var Q = new QuizTable(); Q.QuestionText = QuestionText.Text; Q.ChoiceA = A.Text; Q.ChoiceB = B.Text; Q.ChoiceC = C.Text; Q.ChoiceD = D.Text; Q.Category = Categ; Q.CorrectAnswer = CorAnsw; } await DisplayAlert("Submission Successful", "Question Submitted", "OK"); }