private void silBtn_Click(object sender, EventArgs e) { if (id != -1) { var entity = _musteriServis.Delete(new Musteri { ID = id }); if (entity != null) { BindData(); MessageBox.Show("Silme işlemi başarılı oldu.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); Temizle(); } else { MessageBox.Show("Silme işlemi başarısız oldu.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Lütfen listeden silinecek müsteriyi seçiniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public IActionResult AboneSil(int musteriId) { Musteri musteri = _musteriService.GetById(musteriId); List <Aranacaklar> aranacaklars = _aranacakService.GetAll(musteri.AboneNo); List <Sinyaller> sinyallers = _SinyallerService.GetAboneSinyal(musteri.AboneNo); try { _musteriService.Delete(musteri); foreach (var aranacak in aranacaklars) { _aranacakService.Delete(aranacak); } foreach (var sinyal in sinyallers) { _SinyallerService.Delete(sinyal); } TempData["mesaj"] = "0"; } catch (Exception e) { Console.WriteLine(e); TempData["mesaj"] = "1"; } return(RedirectToAction("Aboneler", "Admin")); }
public async Task <IActionResult> Remove(int id) { try { var firmaid = HttpContext.Session.GetInt32(Metrics.SessionKeys.FirmaId).Value; await _musteriService.Delete(id, firmaid); return(Json(true)); } catch (Exception e) { return(Json(false)); } }
private void barSil_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MessageBox.Show("Müşteri Bilgilerini Silmek İstiyor musunuz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _musteriService.Delete(new Musteri { MusteriId = int.Parse(gridView1.GetFocusedRowCellValue("MusteriId").ToString()) }); MessageBox.Show("Müşteri Bilgileri Silindi ", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information); listele(); } else { MessageBox.Show("Müşteri Bilgileri Silinmedi ", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Sil() { if (id != -1) { try { musteriServis.Delete(new Entities.Concrete.Musteri { Id = id, }); MessageBox.Show("Müşteri silme işlemi başarılı oldu.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Silinecek müşteriyi listeden seçiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } }