public IActionResult Delete(int id) { var template = _templatesService.GetCallQuickTemplateById(id); if (template == null || template.DepartmentId != DepartmentId) { Unauthorized(); } _templatesService.DeleteCallQuickTemplate(id); return(RedirectToAction("Index")); }