コード例 #1
0
 private void btnSil_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(tbMarkaAdı.Text))
     {
         var delete = brandServices.Find(Convert.ToInt32(dgvMarkaData.CurrentRow.Cells[0].Value.ToString()));
         if (delete != null)
         {
             result = brandServices.Delete(delete);
             if (result > 0)
             {
                 MessageBox.Show($"{UserError.ErrorMessage(Convert.ToInt32(UserError.ErrorCode.KayitSilindi))}");
                 dgvMarkaData.DataSource = brandServices.Select();
             }
             else
             {
                 MessageBox.Show($"{UserError.ErrorMessage(Convert.ToInt32(UserError.ErrorCode.KayitSilinmedi))}");
             }
         }
         else
         {
             MessageBox.Show($"{UserError.ErrorMessage(Convert.ToInt32(UserError.ErrorCode.KayitBulunamadı))}");
         }
     }
     else
     {
         MessageBox.Show($"{UserError.ErrorMessage(Convert.ToInt32(UserError.ErrorCode.BosAlan))}");
     }
 }
コード例 #2
0
        public void ThatBrandCanBeDeleted()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.AreEqual(brand,
                            BrandServices.Brands.Single(b => b.Name == brand.Name));
            BrandServices.Delete(brand);
            brand = BrandServices.Brands.FirstOrDefault(b => b.Name == BrandTestFixtures.GetDto().Name);
            Assert.IsNull(brand);
        }
コード例 #3
0
 public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         // TODO: Add delete logic here
         BrandServices.Delete(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }