public ActionResult Details(int? id) { var category = new Category(); if (!id.HasValue) { return HttpNotFound(); } return View(category); }
// // 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); }
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); }
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); }
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); }
// -- 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); }
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); }
/// <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; }
/// <summary> /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCategories(Category category) { base.AddObject("Categories", category); }
public ActionResult CreatePage(Category model) { model.TempID = 1; var redirectController = new CategoryController(); return redirectController.Create(model); }