Ejemplo n.º 1
0
        private void btnGuncelle_Click(object sender, EventArgs e)
        {
            try
            {
                bool success;
                using (var kiralikBusiness = new KiralikBusiness())
                {
                    success = kiralikBusiness.KiralikGuncelle(new Kiralik()
                    {
                        kiraID          = int.Parse(txtKiraID.Text),
                        kiralananAracID = int.Parse(txtKiraAracID.Text),
                        kiraTarihi      = DateTime.Parse(dtpKiraTarihi.Text),
                        verilisKM       = int.Parse(txtVerilisKM.Text),
                        kiraBitisKM     = int.Parse(txtKiraBitisKM.Text),
                        kiraAlinanUcret = int.Parse(txtAlinanUcret.Text),
                        kiralayanKulID  = int.Parse(txtKullID.Text)
                    });
                }
                var message = success ? "Başarıyla güncellendi" : "Hata oluştu";

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

            kiralananListele();
            inputTemizle();
        }
Ejemplo n.º 2
0
        // PUT api/<controller>/5
        public IHttpActionResult Put(int id, [FromBody] Kiralik kiralik)
        {
            var content = new ResponseContent <Kiralik>(null);

            if (kiralik != null)
            {
                using (var kiralikBusiness = new KiralikBusiness())
                {
                    content.Result = kiralikBusiness.KiralikGuncelle(kiralik) ? "1" : "0";

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

            content.Result = "0";

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