//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;
        }
示例#3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Quistion quistion = await db.Quistions.FindAsync(id);

            db.Quistions.Remove(quistion);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#4
0
        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));
        }
示例#5
0
        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));
        }
示例#6
0
        // 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));
        }