public ActionResult DeleteConfirmed(int id)
        {
            questiontbl questiontbl = db.questiontbls.Find(id);

            db.questiontbls.Remove(questiontbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "q_id,question")] questiontbl questiontbl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(questiontbl).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(questiontbl));
 }
        public ActionResult Create([Bind(Include = "q_id,question")] questiontbl questiontbl)
        {
            if (ModelState.IsValid)
            {
                db.questiontbls.Add(questiontbl);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(questiontbl));
        }
        // GET: ques/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            questiontbl questiontbl = db.questiontbls.Find(id);

            if (questiontbl == null)
            {
                return(HttpNotFound());
            }
            return(View(questiontbl));
        }
示例#5
0
 public ActionResult Create(Questionmodel questionmodel)
 {
     try
     {
         using (HapinessSurveyEntities entities = new HapinessSurveyEntities())
         {
             //var addques = entities.questiontbls.Where(a => a.q_id.Equals(questionmodel.q_id)).First();
             questiontbl ques = new questiontbl();
             // List < Questionmodel > qlist = new List<Questionmodel>();
             ques.question = questionmodel.questions;
             entities.questiontbls.Add(ques);
             entities.SaveChanges();
             return(View("question"));
         }
     }
     catch (Exception)
     {
         throw;
     }
     // return View("Edit");
 }