コード例 #1
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            try
            {
                munService.Delete(id);

                TempData["Success"] = "Successfully Deleted!!";

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                TempData["Danger"] = $"Opppps something went wrong {e.Message}";
            }

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentMunicipality == null)
            {
                MainWindow.WarningMessage = ((string)Application.Current.FindResource("Morate_odabrati_stavku_za_brisanjeUzvičnik"));
                return;
            }

            // Delete data
            var result = municipalityService.Delete(CurrentMunicipality.Identifier);

            if (result.Success)
            {
                MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Podaci_su_uspešno_obrisaniUzvičnik"));

                Thread displayThread = new Thread(() => SyncData());
                displayThread.IsBackground = true;
                displayThread.Start();
            }
            else
            {
                MainWindow.ErrorMessage = result.Message;
            }
        }
コード例 #3
0
ファイル: MunicipalityController.cs プロジェクト: nikaku/Hr
 public IActionResult Delete(int id)
 {
     _municipalityService.Delete(id);
     return(Ok());
 }
コード例 #4
0
        public IActionResult Delete(string municipalityName)
        {
            var isDeleted = _municipalityService.Delete(municipalityName);

            return(isDeleted ? (IActionResult)Ok() : BadRequest());
        }