Exemple #1
0
 private void barbtnkaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (MessageBox.Show("Ürünü Kayıt Etmek İstiyor musunuz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         try
         {
             _urunService.Add(new Urun
             {
                 UrunAd     = textAd.Text,
                 Marka      = textMarka.Text,
                 Model      = textModel.Text,
                 Yil        = int.Parse(maskYil.Text),
                 Adet       = int.Parse(numAdet.Text),
                 Maliyet    = decimal.Parse(textMaliyet.Text),
                 SatisFiyat = decimal.Parse(textSatis.Text),
                 Detay      = richDetay.Text
             });
             _stokService.Add(new Stok
             {
                 StokTur  = textAd.Text,
                 StokAdet = int.Parse(numAdet.Text)
             });
             MessageBox.Show("Kayıt İşlemi Başarılı. Değişiklikleri Görmek için YENİLE Butonuna Basınız", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message);
         }
     }
     else
     {
         MessageBox.Show("Ürün Kayıt Edilmedi", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #2
0
        public IActionResult Add(Stok stok)
        {
            var result = _stokService.Add(stok);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }