public ActionResult Delete(Guid id) { var result = false; try { result = _categoryApplication.Delete(id); } catch (Exception ex) { this.AddToastMessage("", "Category cannot be deleted. There is one or more products associated with it.", ToastType.Error); return(RedirectToAction("Index")); } if (result) { this.AddToastMessage("", "Category deleted with success.", ToastType.Success); } else { this.AddToastMessage("", "Error while deleting Category.", ToastType.Error); } return(RedirectToAction("Index")); }