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

            db.C_News_category.Remove(c_News_category);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "id,category_name,photo,title,author,dates,text,pages,type_id,categoryID")] C_News_category c_News_category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(c_News_category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.categoryID = new SelectList(db.categories, "id", "name", c_News_category.categoryID);
     ViewBag.type_id    = new SelectList(db.types, "id", "name", c_News_category.type_id);
     return(View(c_News_category));
 }
Пример #3
0
        // GET: Admin/C_News_category/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            C_News_category c_News_category = db.C_News_category.Find(id);

            if (c_News_category == null)
            {
                return(HttpNotFound());
            }
            return(View(c_News_category));
        }
Пример #4
0
        // GET: Admin/C_News_category/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            C_News_category c_News_category = db.C_News_category.Find(id);

            if (c_News_category == null)
            {
                return(HttpNotFound());
            }
            ViewBag.categoryID = new SelectList(db.categories, "id", "name", c_News_category.categoryID);
            ViewBag.type_id    = new SelectList(db.types, "id", "name", c_News_category.type_id);
            return(View(c_News_category));
        }