Beispiel #1
0
        public ActionResult Details(int? id)
        {
            var category = new Category();
            if (!id.HasValue)
            {
                return HttpNotFound();
            }

            return View(category);
        }
Beispiel #2
0
        //
        // GET: /ShowCategory/
        public ActionResult Index(int? id)
        {
            var category = new Category();

            if(id.HasValue)
            {
                category = db.Categories.Include("Texts").Include("Videos").Include("Links").Include("Pictures").First(c => c.CatID == id.Value);
            }

            return View(category);
        }
Beispiel #3
0
        public ActionResult Create(Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.AddObject(category);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.TempID = new SelectList(db.Templates, "TempID", "TempName", category.TempID);
            return View(category);
        }
Beispiel #4
0
        public ActionResult Create(Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.AddObject(category);
                db.SaveChanges();
                return new RedirectResult("~/Admin/Content/" + category.CatID, false);
            }

            ViewBag.TempID = new SelectList(db.Templates, "TempID", "TempName", category.TempID);
            return View(category);
        }
Beispiel #5
0
        public ActionResult ShowStartPage()
        {
            var startpage = db.SiteConfigs.First();
            var startid = startpage.SiteStartCatID;

            var category = new Category();

            if (startid.HasValue)
            {
                category = db.Categories.Include("Texts").Include("Videos").Include("Links").Include("Pictures").First(c => c.CatID == startid.Value);
            }

            return PartialView(category);
        }
Beispiel #6
0
        // -- Content --
        public ActionResult Content(int? id)
        {
            var category = new Category();

            if (id.HasValue)
            {
                category = db.Categories.First(c => c.CatID == id.Value);
            }
            else
            {
                return RedirectToAction("ContentNoID");
            }

            return View(category);
        }
Beispiel #7
0
 public ActionResult Edit(Category category)
 {
     if (ModelState.IsValid)
     {
         db.Categories.Attach(category);
         db.ObjectStateManager.ChangeObjectState(category, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TempID = new SelectList(db.Templates, "TempID", "TempName", category.TempID);
     return View(category);
 }
Beispiel #8
0
 /// <summary>
 /// Create a new Category object.
 /// </summary>
 /// <param name="catID">Initial value of the CatID property.</param>
 /// <param name="catName">Initial value of the CatName property.</param>
 public static Category CreateCategory(global::System.Int64 catID, global::System.String catName)
 {
     Category category = new Category();
     category.CatID = catID;
     category.CatName = catName;
     return category;
 }
Beispiel #9
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCategories(Category category)
 {
     base.AddObject("Categories", category);
 }
Beispiel #10
0
 public ActionResult CreatePage(Category model)
 {
     model.TempID = 1;
     var redirectController = new CategoryController();
     return redirectController.Create(model);
 }