public async Task <ActionResult> DeleteConfirmed(int?empNo, string title1) { Expression <Func <Title, bool> > titlePred = t => (t.EmpNo == empNo && t.Title1 == title1); var title = _titleService.FindTitle(titlePred).Result.FirstOrDefault(); try { if (title == null) { return(RedirectToAction("Error", "Home")); } await _titleService.DeleteTitle(title); return(RedirectToAction("Index")); } catch (Exception ex) { if (ex.InnerException != null) { int index = ex.InnerException.Message.IndexOf("fails"); string message = ex.InnerException.Message; if (index > 0) { message = message.Substring(0, index - 1); } ModelState.AddModelError("Error", "There was an error during: " + message); } else { ModelState.AddModelError("Error", "There was an error during: " + ex.ToString()); } return(View(title)); } }
private void buttonDeleteTitle_Click(object sender, EventArgs e) { _titleManager.DeleteTitle(_idTitle); MessageBox.Show("Title silindi"); ListMyTitles(); ClearTitleTexts(); FillTitleComboBoxes(); }
public ActionResult Delete(int id) { try { _titleService.DeleteTitle(id); } catch (Exception e) { Logger.Write("Error deleting Title Id=" + id, e); } return(RedirectToAction("List")); }
public ActionResult DeleteTitle(int id) { _titleManager.DeleteTitle(id); TempData["message"] = "Ünvan silindi"; return(RedirectToAction("TitleManiPage")); }