Exemplo n.º 1
0
 private void button5_Click(object sender, EventArgs e)
 {
     Models.Categories category = categories.GetCategories().Where(x => x.Name == comboBox2.Text).Select(n => n).FirstOrDefault();
     if (!(category.Products == null))
     {
         categories.Remove(category);
         MessageBox.Show("Kategori başarıyla silindi.", "Başarılı");
     }
     else
     {
         MessageBox.Show("Kategori içerisinde ürün tanımlı.", "HATA");
     }
 }
 private void button3_Click(object sender, EventArgs e)
 {
     Models.Products products = new Products();
     products.Name        = textBox1.Text;
     products.Price       = float.Parse(textBox2.Text);
     products.Description = textBox3.Text;
     Models.Categories category = categories.GetCategories().Where(x => x.Name == comboBox1.Text).Select(n => n).FirstOrDefault();
     products.Category     = category;
     products.CategoryId   = category.Id;
     products.CategoryName = category.Name;
     business.Add(products);
     MessageBox.Show("Ürün başarıyla eklendi.", "Başarılı");
 }
Exemplo n.º 3
0
 private void button4_Click(object sender, EventArgs e)
 {
     groupBox1.Visible = true;
     Models.Categories category = categories.GetCategories().Where(x => x.Name == comboBox1.Text).Select(n => n).FirstOrDefault();
     textBox2.Text = category.Name;
 }