private BackgroundTaskItem GetBackgroundTaskItem(BackgroundTaskItem request) { var id = request?.Id; BackgroundTaskItem ret = null; var query = DocQuery.ActiveQuery ?? Execute; DocPermissionFactory.SetSelect <BackgroundTaskItem>(currentUser, "BackgroundTaskItem", request.Select); DocEntityBackgroundTaskItem entity = null; if (id.HasValue) { entity = DocEntityBackgroundTaskItem.Get(id.Value); } if (null == entity) { throw new HttpError(HttpStatusCode.NotFound, $"No BackgroundTaskItem found for Id {id.Value}"); } if (!DocPermissionFactory.HasPermission(entity, currentUser, DocConstantPermission.VIEW)) { throw new HttpError(HttpStatusCode.Forbidden, "You do not have VIEW permission for this route."); } ret = entity?.ToDto(); return(ret); }
public object Get(BackgroundTaskItem request) => GetEntityWithCache <BackgroundTaskItem>(DocConstantModelName.BACKGROUNDTASKITEM, request, GetBackgroundTaskItem);