private void btnKaydet_Click(object sender, EventArgs e) { try { int islemSonucu = markaManager.Add( new Marka { Aktif = chbAktif.Checked, EklenmeTarihi = DateTime.Now, MarkaAciklamasi = txtMarkaAciklamasi.Text, MarkaAdi = txtMarkaAdi.Text } ); if (islemSonucu > 0) { dgvMarkalar.DataSource = markaManager.GetAll(); MessageBox.Show("Marka Eklendi!"); } else { MessageBox.Show("Marka Eklenemedi!"); } } catch (Exception) { MessageBox.Show("Hata Oluştu!"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack)//sayfada butona tıklanmamışsa { ddlUrunKategorisi.DataSource = km.GetAll(); ddlUrunKategorisi.DataBind(); ddlUrunMarkasi.DataSource = mm.GetAll(); ddlUrunMarkasi.DataBind(); } }
void DatalariYukle() { dgvUrunler.DataSource = urunManager.GetAll(); cbUrunKategorisi.DataSource = kategoriManager.GetAll(); cbUrunKategorisi.DisplayMember = "KategoriAdi"; cbUrunKategorisi.ValueMember = "Id"; cbUrunMarkasi.DataSource = markaManager.GetAll(); cbUrunMarkasi.DisplayMember = "MarkaAdi"; cbUrunMarkasi.ValueMember = "Id"; }
public ActionResult AddProduct() { if (Session["Admin"] != null) { List <Marka> markalar = MarkaManager.GetAll(); List <SelectListItem> items = new List <SelectListItem>(); foreach (var item in markalar) { items.Add(new SelectListItem { Text = item.MarkaAdi, Value = item.MarkaId.ToString() }); } ViewBag.Markalar = items; return(View()); } else { return(View("Login")); } }
private void FormAracEkle_Load(object sender, EventArgs e) { cmbMarka.DataSource = _markaManager .GetAll() .Select(i => i.MarkaAdi) .ToList(); cmbModel.DataSource = _modelManager .GetAll() .Where(i => i.Marka.MarkaAdi == cmbMarka.Text) .Select(i => i.ModelAdi) .ToList(); }
public PartialViewResult GetAllMarka() { return(PartialView(manager.GetAll())); }
// GET: Admin/Marka public ActionResult Index() { return(View(db.GetAll())); }
// GET: Admin/Urun/Create public ActionResult Create() { ViewBag.KategoriId = new SelectList(kategoriManager.GetAll(), "Id", "KategoriAdi"); ViewBag.MarkaId = new SelectList(marka.GetAll(), "Id", "MarkaAdi"); return(View()); }