private async void DeleteMethod()
        {
            MessageDialogResult result = await _currentWindow.ShowMessageAsync("تأكيد الحذف", "هل تـريــد حــذف هـذه الشركة؟", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings()
            {
                AffirmativeButtonText = "موافق",
                NegativeButtonText    = "الغاء",
                DialogMessageFontSize = 25,
                DialogTitleFontSize   = 30
            });

            if (result == MessageDialogResult.Affirmative)
            {
                if (_companyServ.IsExistInCategories(_selectedCompany.ID))
                {
                    await _currentWindow.ShowMessageAsync("فشل الحذف", "لا يمكن حذف هذه الشركة", MessageDialogStyle.Affirmative, new MetroDialogSettings()
                    {
                        AffirmativeButtonText = "موافق",
                        DialogMessageFontSize = 25,
                        DialogTitleFontSize   = 30
                    });

                    return;
                }
                _companyServ.DeleteCompany(_selectedCompany);
                companies.Remove(_selectedCompany);
                GetCurrentPage();
            }
        }
        public void ServiceCascadeDelete()
        {
            services.CreateCompany("com1", 100);
            services.CreateCompany("com2", 120, services.FindCompany("com1"));
            Company com1 = services.FindCompany("com1");

            services.DeleteCompany(com1);
            Company com2;

            try
            {
                com2 = services.FindCompany("com2");
            }
            catch
            {
                com2 = null;
            }
            Assert.IsNull(com2);
        }
        public void Initialize()
        {
            services = new CompanyServices();
            context  = new DataContext();
            List <Company> list = services.FindListCompanies();

            foreach (Company item in list)
            {
                services.DeleteCompany(item.Id);
            }
        }
예제 #4
0
        private async void DeleteMethod()
        {
            MessageDialogResult result = await _currentWindow.ShowMessageAsync("تأكيد الحذف", "هل تـريــد حــذف هـذه الشركة؟", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings()
            {
                AffirmativeButtonText = "موافق",
                NegativeButtonText    = "الغاء",
                DialogMessageFontSize = 25,
                DialogTitleFontSize   = 30
            });

            if (result == MessageDialogResult.Affirmative)
            {
                _companyServ.DeleteCompany(_selectedCompany);
                Load();
            }
        }
예제 #5
0
        public ActionResult Delete(string id)
        {
            var result = _cServices.DeleteCompany(id);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Delete(int id)
 {
     companyServices.DeleteCompany(companyServices.FindCompany(id));
     return(new HttpStatusCodeResult(204));
 }