예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            polls polls = db.polls.Find(id);

            db.polls.Remove(polls);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "PollId,Question,Option1,Option2,Active,Yes,No")] polls polls)
 {
     if (ModelState.IsValid)
     {
         db.Entry(polls).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(polls));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "PollId,Question,Option1,Option2,Active,Yes,No")] polls polls)
        {
            if (ModelState.IsValid)
            {
                db.polls.Add(polls);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(polls));
        }
예제 #4
0
        // GET: polls/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            polls polls = db.polls.Find(id);

            if (polls == null)
            {
                return(HttpNotFound());
            }
            return(View(polls));
        }
예제 #5
0
        public ActionResult Negative(int id)
        {
            polls polls = db.polls.Find(id);

            if (polls == null)
            {
                return(HttpNotFound());
            }
            //polls polls = db.polls.Find(id);
            polls.No += 1;
            if (ModelState.IsValid)
            {
                db.Entry(polls).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }