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")); }
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; } }
public IActionResult Delete(int id) { _municipalityService.Delete(id); return(Ok()); }
public IActionResult Delete(string municipalityName) { var isDeleted = _municipalityService.Delete(municipalityName); return(isDeleted ? (IActionResult)Ok() : BadRequest()); }