public IHttpActionResult Putspellingquestion(string id, spellingquestion spellingquestion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != spellingquestion.question_id) { return(BadRequest()); } db.Entry(spellingquestion).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!spellingquestionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Postspellingquestion(spellingquestion spellingquestion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.spellingquestions.Add(spellingquestion); try { db.SaveChanges(); } catch (DbUpdateException) { if (spellingquestionExists(spellingquestion.question_id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = spellingquestion.question_id }, spellingquestion)); }
public ActionResult DeleteConfirmed(string id) { spellingquestion spellingquestion = db.spellingquestions.Find(id); db.spellingquestions.Remove(spellingquestion); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "question_id,question_type,image_dir,answer,image1_dir,image2_dir,image3_dir,image4_dir,image5_dir,image6_dir,image7_dir,image8_dir")] spellingquestion spellingquestion) { if (ModelState.IsValid) { db.Entry(spellingquestion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(spellingquestion)); }
private void UpdateResources(spellingquestion selecteditem) { questionno = int.Parse(ViewState["questionno"].ToString()); lblQuestionType.Text = selecteditem.question_type.ToString() + "S"; lblInstruction.Text = "Spell the answer for the image below using fingerspelling"; lblQuestion.Text = questionno.ToString(); lblScore.Text = ViewState["score"].ToString(); imgQuestion.ImageUrl = selecteditem.image_dir.ToString(); ViewState["answer"] = selecteditem.answer; //lblTime.Text = aindex.ToString(); }
public ActionResult Create([Bind(Include = "question_id,question_type,image_dir,answer,image1_dir,image2_dir,image3_dir,image4_dir,image5_dir,image6_dir,image7_dir,image8_dir")] spellingquestion spellingquestion) { if (ModelState.IsValid) { db.spellingquestions.Add(spellingquestion); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(spellingquestion)); }
public IHttpActionResult Deletespellingquestion(string id) { spellingquestion spellingquestion = db.spellingquestions.Find(id); if (spellingquestion == null) { return(NotFound()); } db.spellingquestions.Remove(spellingquestion); db.SaveChanges(); return(Ok(spellingquestion)); }
// GET: spellingquestionsM/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } spellingquestion spellingquestion = db.spellingquestions.Find(id); if (spellingquestion == null) { return(HttpNotFound()); } return(View(spellingquestion)); }
private void NextQuestion() { if (int.Parse(ViewState["questionno"].ToString()) < 4) { ViewState["questionno"] = int.Parse(ViewState["questionno"].ToString()) + 1; taken1 = false; taken2 = false; taken3 = false; taken4 = false; taken5 = false; taken6 = false; taken7 = false; taken8 = false; int qindex = rdm.Next(0, questionlist.Count); spellingquestion selectedItem = questionlist[qindex]; image_dir = selectedItem.image_dir; answer = selectedItem.answer; int rdm1 = rdm.Next(1, 9); int rdm2 = rdm.Next(1, 9); int rdm3 = rdm.Next(1, 9); int rdm4 = rdm.Next(1, 9); int rdm5 = rdm.Next(1, 9); int rdm6 = rdm.Next(1, 9); int rdm7 = rdm.Next(1, 9); int rdm8 = rdm.Next(1, 9); RandomizeImageButton(rdm1, selectedItem.image1_dir, questiontype); RandomizeImageButton(rdm2, selectedItem.image2_dir, questiontype); RandomizeImageButton(rdm3, selectedItem.image3_dir, questiontype); RandomizeImageButton(rdm4, selectedItem.image4_dir, questiontype); RandomizeImageButton(rdm5, selectedItem.image5_dir, questiontype); RandomizeImageButton(rdm6, selectedItem.image6_dir, questiontype); RandomizeImageButton(rdm7, selectedItem.image7_dir, questiontype); RandomizeImageButton(rdm8, selectedItem.image8_dir, questiontype); UpdateResources(selectedItem); questionlist.RemoveAt(qindex); } else { UpdateFinalResources(); } }