//Actions public void AddQuistion() { QuistionCollection.Add(_editedQuistion); _editedQuistion = new Quistion(); SelectedIndex = QuistionCollection.Count - 1; OnPropertyChanged(nameof(QuistionCollection)); }
public void UpdateQuistion() { int index = SelectedIndex; QuistionCollection[index] = _editedQuistion; _editedQuistion = new Quistion(); SelectedIndex = index; }
public async Task <ActionResult> DeleteConfirmed(int id) { Quistion quistion = await db.Quistions.FindAsync(id); db.Quistions.Remove(quistion); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "IdQuestion,IdFlat,Question,Answer,Status")] Quistion quistion) { if (ModelState.IsValid) { db.Entry(quistion).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(quistion)); }
public async Task <ActionResult> Create([Bind(Include = "IdQuestion,IdFlat,Question,Answer,Status")] Quistion quistion) { if (ModelState.IsValid) { db.Quistions.Add(quistion); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(quistion)); }
// GET: Quistions/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Quistion quistion = await db.Quistions.FindAsync(id); if (quistion == null) { return(HttpNotFound()); } return(View(quistion)); }