Ejemplo n.º 1
0
        private void btnYeniKaydet_Click(object sender, EventArgs e)
        {
            try
            {
                bool success;
                using (var sirketBusiness = new SirketBusiness())
                {
                    success = sirketBusiness.SirketEkle(new Sirket()
                    {
                        sirketAdi        = txtSirketAdi.Text,
                        sirketSehir      = txtSirketSehir.Text,
                        sirketAracSayisi = int.Parse(txtAracSayisi.Text),
                        sirketPuani      = int.Parse(txtSirketPuani.Text),
                        sirketAdres      = txtSirketAdres.Text
                    });
                }
                var message = success ? "Başarıyla eklendi" : "Hata oluştu";

                MessageBox.Show(message);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error happened: " + ex.Message);
            }

            sirketListele();
            inputTemizle();
        }
 public bool SirketEkle(Sirket entity)
 {
     try
     {
         using (var business = new SirketBusiness())
         {
             business.SirketEkle(entity);
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        // POST api/<controller>
        public IHttpActionResult Post([FromBody] Sirket sirket)
        {
            var content = new ResponseContent <Sirket>(null);

            if (sirket != null)
            {
                using (var sirketBusiness = new SirketBusiness())
                {
                    content.Result = sirketBusiness.SirketEkle(sirket) ? "1" : "0";

                    return(new StandartResult <Sirket>(content, Request));
                }
            }

            content.Result = "0";

            return(new StandartResult <Sirket>(content, Request));
        }