public ActionResult Edit(int id) { Alt_Kategori alt_Kategori = db.Alt_Kategori.Find(id); ViewBag.KategoriID = new SelectList(db.Kategori, "KategoriID", "KategoriAd", alt_Kategori.KategoriID); return(View(alt_Kategori)); }
public ActionResult DeleteConfirmed(int id) { Alt_Kategori alt_Kategori = db.Alt_Kategori.Find(id); db.Alt_Kategori.Remove(alt_Kategori); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Alt_Kategori model) { if (ModelState.IsValid) { var attached = db.Alt_Kategori.Attach(model); db.Entry(attached).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.KategoriID = new SelectList(db.Kategori, "KategoriID", "KategoriAd", model.KategoriID); return(View(model)); }
public ActionResult Create([Bind(Include = "AK_ID,KategoriID,Ad")] Alt_Kategori alt_Kategori) { if (ModelState.IsValid) { db.Alt_Kategori.Add(alt_Kategori); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.KategoriID = new SelectList(db.Kategori, "KategoriID", "KategoriAd", alt_Kategori.KategoriID); return(View(alt_Kategori)); }
// GET: Admin/AltKategori/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Alt_Kategori alt_Kategori = db.Alt_Kategori.Find(id); if (alt_Kategori == null) { return(HttpNotFound()); } return(View(alt_Kategori)); }
protected void YanMenuOlustur() { IEnumerable <Kategori> kategoriler = eticaretDB.Kategoris; for (int i = 0; i < kategoriler.Count(); i++) { Kategori kategori = new Kategori(); kategori = kategoriler.ElementAt(i); IEnumerable <Alt_Kategori> alt_kategoriler = eticaretDB.Alt_Kategoris.Where(ak => ak.KategoriID == kategori.KategoriID); HtmlGenericControl li_kategori = new HtmlGenericControl("li"); li_kategori.Attributes.Add("class", "li_yanMenu"); ul_yanMenu.Controls.Add(li_kategori); HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor(); anchor.InnerText = kategori.KategoriAdi; string altKategoriPage = "AltKategori.aspx?KategoiID=" + kategori.KategoriID.ToString(); anchor.Attributes.Add("href", altKategoriPage); li_kategori.Controls.Add(anchor); HtmlGenericControl ul = new HtmlGenericControl("ul"); li_kategori.Controls.Add(ul); HtmlGenericControl li_altKategori = new HtmlGenericControl("li"); ul.Controls.Add(li_altKategori); for (int j = 0; j < alt_kategoriler.Count(); j++) { Alt_Kategori alt_kategori = new Alt_Kategori(); alt_kategori = alt_kategoriler.ElementAt(j); HtmlGenericControl anchor1 = new HtmlGenericControl("a"); string urunPage = "Urun.aspx?AltKategoriID=" + alt_kategori.AltKategoriID.ToString(); anchor1.Attributes.Add("href", urunPage); anchor1.InnerText = alt_kategori.AltKategoriAdi; li_altKategori.Controls.Add(anchor1); } } }
protected void YanMenuOlustur(IEnumerable <Alt_Kategori> altKategoriler) { List <Urun> urunler = new List <Urun>(); for (int i = 0; i < altKategoriler.Count(); i++) { #region Yan Menü Alt_Kategori altKategori = new Alt_Kategori(); altKategori = altKategoriler.ElementAt(i); HtmlGenericControl li_altKategori = new HtmlGenericControl("li"); li_altKategori.Attributes.Add("class", "li_yanMenu"); ul_altKategoriMenu.Controls.Add(li_altKategori); HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor(); anchor.InnerText = altKategori.AltKategoriAdi; string urunPage = "Urun.aspx?AltKategoriID=" + altKategori.AltKategoriID.ToString(); anchor.Attributes.Add("href", urunPage); li_altKategori.Controls.Add(anchor); #endregion } }