Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ctgs ctgs = db.categories_table.Find(id);

            db.categories_table.Remove(ctgs);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id,CategoryName")] ctgs ctgs)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ctgs).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ctgs));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "Id,CategoryName")] ctgs ctgs)
        {
            if (ModelState.IsValid)
            {
                db.categories_table.Add(ctgs);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ctgs));
        }
Пример #4
0
 // GET: ctgs/Edit/5
 public ActionResult Edit(int?id)
 {
     if (Admincheck())
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         ctgs ctgs = db.categories_table.Find(id);
         if (ctgs == null)
         {
             return(HttpNotFound());
         }
         return(View(ctgs));
     }
     else
     {
         return(Content("You do not have access to this data "));
     }
 }