Пример #1
0
 public ActionResult Edit([Bind(Include = "FAQID,Question,Answer,Active")] tblFAQ tblFAQ)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblFAQ).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblFAQ));
 }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblFAQ tblFAQ = db.tblFAQs.Find(id);

            db.tblFAQs.Remove(tblFAQ);

            tblFAQ.FAQActive = false;

            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
        // GET: FAQs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblFAQ tblFAQ = db.tblFAQs.Find(id);

            if (tblFAQ == null)
            {
                return(HttpNotFound());
            }
            return(View(tblFAQ));
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "FAQID,FAQQuestion,FAQAnswer,FAQDateTime,FAQActive")] tblFAQ tblFAQ)
        {
            if (ModelState.IsValid)
            {
                tblFAQ.FAQActive   = true;
                tblFAQ.FAQDateTime = DateTime.Now;

                db.tblFAQs.Add(tblFAQ);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblFAQ));
        }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        tblFAQ faqTbl = new tblFAQ();

        if (txtTitle.Text.Trim().Length > 0)
        {
            faqTbl.faqTitle  = txtTitle.Text;
            faqTbl.faqDetail = txtDetail.Text;
            faqTbl.allow     = "1";
            faqTbl.Create();

            Response.Redirect("faq.aspx");
        }
        else
        {
            lblError.Text = "* Please enter question frist.";
        }
    }