public int Add(Bolge bolge)
        {
            context.Bolgeler.Add(bolge);
            int value = context.SaveChanges();

            return(value);
        }
Example #2
0
        public async Task <IActionResult> PutBolge([FromRoute] int id, [FromBody] Bolge bolge)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != bolge.Id)
            {
                return(BadRequest());
            }

            _context.Entry(bolge).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BolgeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Bolge bolge = db.Bolgeler.Find(id);

            db.Bolgeler.Remove(bolge);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        private void btnSil_Click(object sender, EventArgs e)
        {
            int   id    = (int)dvBolgeler.CurrentRow.Cells[0].Value;
            Bolge bolge = controller.GetById(id);

            controller.Delete(bolge);
            Listele();
        }
Example #5
0
        public ActionResult BolgeSil(int?id)
        {
            Bolge bolge = db.Bolgeler.Find(id);

            db.Bolgeler.Remove(bolge);
            db.SaveChanges();
            return(RedirectToAction("BolgeEkle"));
        }
        public int Delete(Bolge bolge)
        {
            var entity = context.Entry(bolge);

            entity.State = System.Data.Entity.EntityState.Deleted;
            int value = context.SaveChanges();

            return(value);
        }
Example #7
0
 public ActionResult BolgeDuzenle(Bolge bolge)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bolge).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("BolgeEkle"));
     }
     return(View());
 }
        private void btnGuncelle_Click(object sender, EventArgs e)
        {
            int   id    = (int)dvBolgeler.CurrentRow.Cells[0].Value;
            Bolge bolge = controller.GetById(id);

            bolge.Ad           = txtAd.Text;
            bolge.UlasimGideri = nmrGider.Value;
            controller.Update(bolge);
            Listele();
        }
 public ActionResult Edit([Bind(Include = "Id,Adi")] Bolge bolge)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bolge).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bolge));
 }
Example #10
0
 public ActionResult BolgeEkle(Bolge bolge)
 {
     ViewData["BolgeListe"] = db.Bolgeler.ToList();
     if (ModelState.IsValid)
     {
         db.Bolgeler.Add(bolge);
         db.SaveChanges();
         return(RedirectToAction("BolgeEkle", "Proje"));
     }
     return(View());
 }
        public ActionResult Create([Bind(Include = "Id,Adi")] Bolge bolge)
        {
            if (ModelState.IsValid)
            {
                db.Bolgeler.Add(bolge);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(bolge));
        }
Example #12
0
        public async Task <IActionResult> PostBolge([FromBody] Bolge bolge)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Bolge.Add(bolge);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBolge", new { id = bolge.Id }, bolge));
        }
 public ActionResult Duzenle(Bolge bhr)
 {
     using (TurkeyContext tx = new TurkeyContext())
     {
         tx.Entry(bhr).State = EntityState.Modified;
         int sonuc = tx.SaveChanges();
         if (sonuc > 0)
         {
             return(RedirectToAction("Index"));
         }
         return(View());
     }
 }
        // GET: Bolge/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bolge bolge = db.Bolgeler.Find(id);

            if (bolge == null)
            {
                return(HttpNotFound());
            }
            return(View(bolge));
        }
Example #15
0
 public void temizle()
 {
     id.Clear();
     Bolge.Clear();
     Baslangic.Clear();
     Bitis.Clear();
     Kadir.Clear();
     Bayram.Clear();
     Tarih.Clear();
     Gun.Clear();
     Sahur.Clear();
     Ogle.Clear();
     Ikindi.Clear();
     Iftar.Clear();
     Yatsi.Clear();
 }
 public bool Ekle(Bolge b)
 {
     if (ModelState.IsValid)
     {
         using (TurkeyContext tx = new TurkeyContext())
         {
             tx.Bolgeler.Add(b);
             int sonuc = tx.SaveChanges();
             if (sonuc > 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #17
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            if (!KontrolEt())
            {
                Bolge bolge = new Bolge()
                {
                    Ad = txtAd.Text, UlasimGideri = nmrGider.Value
                };
                controller.Add(bolge);
                Listele();

                txtAd.Text     = string.Empty;
                nmrGider.Value = 0;
            }
            else
            {
                MessageBox.Show("Lütfen boş alanları doldurunuz.");
            }
        }
        public Bolge GetById(int id)
        {
            Bolge selected = context.Bolgeler.SingleOrDefault(x => x.BolgeId == id);

            return(selected);
        }
        private void btnKaydet_Click_1(object sender, EventArgs e)
        {
            if (!KontrolEt())
            {
                Turistler turistler = new Turistler();
                turistler.AdSoyad     = txtAdSoyad.Text;
                turistler.Cinsiyet    = cbCinsiyet.Text;
                turistler.Telefon     = txtTelefon.Text;
                turistler.Mail        = txtMail.Text;
                turistler.Uyruk       = txtUyruk.Text;
                turistler.DogumTarihi = dtpDogumTarihi.Value;
                turistler.BolgeId     = Convert.ToInt32(cbBolge.SelectedValue);
                turistler.FaturaId    = faturaContoller.GetLast().FaturaId;
                turistler.TurBiletiId = turBiletiController.GetLast().Id;

                if ((DateTime.Now.Year - turistler.DogumTarihi.Year) <= 10)
                {
                    fiyat += tur.Fiyat * 0.5m;
                }
                else if ((DateTime.Now.Year - turistler.DogumTarihi.Year) > 60)
                {
                    fiyat += tur.Fiyat * 0.75m;
                }
                else
                {
                    fiyat += tur.Fiyat;
                }
                fiyat += turController.TurunYerlerininFiyatlariGetir(tur);

                Bolge bolge = new Bolge();
                bolge  = (Bolge)cbBolge.SelectedItem;
                fiyat += bolge.UlasimGideri;
                turistlerContoller.Add(turistler);
                sayac++;
                lblKisi.Text = $"{sayac.ToString()}. Kişi";

                if (sayac > kisiSayisi)
                {
                    lblKisi.Text      = $"{kisiSayisi.ToString()}. Kişi";
                    fatura.Tutar      = fiyat;
                    btnKaydet.Enabled = false;

                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(frmBiletAl.today);
                    string  Dolar      = xmlDoc.SelectSingleNode("Tarih_Date/Currency[@Kod='USD']/BanknoteBuying").InnerXml;
                    string  Euro       = xmlDoc.SelectSingleNode("Tarih_Date/Currency[@Kod='EUR']/BanknoteBuying").InnerXml;
                    decimal DolarFiyat = fiyat / Convert.ToDecimal(Dolar);
                    decimal EuroFiyat  = fiyat / Convert.ToDecimal(Euro);
                    lblFiyat.Text = string.Format("{0}₺ - {1}$ - {2}€", fiyat, Decimal.Round(DolarFiyat, 2), Decimal.Round(EuroFiyat, 2));
                    MessageBox.Show($"İşlem başarıyla tamamlanmıştır. Bilet Numaranız:{bilet.Id}");
                }
                foreach (Control control in this.Controls)
                {
                    if (control is TextBox)
                    {
                        control.Text = string.Empty;
                    }
                }
            }
            else
            {
                MessageBox.Show("Lütfen boş alanları doldurunuz.");
            }
        }
Example #20
0
 public bool Add(Bolge bolge)
 {
     return(manager.Add(bolge) > 0);
 }
Example #21
0
 public bool Update(Bolge bolge)
 {
     return(manager.Update(bolge) > 0);
 }
Example #22
0
 public bool Delete(Bolge bolge)
 {
     return(manager.Delete(bolge) > 0);
 }
Example #23
0
 private void Mayinalani_Click(object sender, EventArgs e)
 {
     Bolge bolge = (Bolge)sender;
 }