public IActionResult CompleteTreatment(int id) { var result = Execute(() => { bool isMedEmployee = _userManager.IsUserInMedEmployeeRole(User.Identity.Name); if (!isMedEmployee) { throw new UnauthorizedAccessException("You have not appropriate rights to access this action"); } _treatmentService.CompleteTreatment(id); }); return(Json(result)); }