Exemplo n.º 1
0
        private ValueType GetValueType(ValueType request)
        {
            var       id    = request?.Id;
            ValueType ret   = null;
            var       query = DocQuery.ActiveQuery ?? Execute;

            DocPermissionFactory.SetSelect <ValueType>(currentUser, "ValueType", request.Select);

            DocEntityValueType entity = null;

            if (id.HasValue)
            {
                entity = DocEntityValueType.Get(id.Value);
            }
            if (null == entity)
            {
                throw new HttpError(HttpStatusCode.NotFound, $"No ValueType 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);
        }
Exemplo n.º 2
0
 public object Get(ValueType request) => GetEntityWithCache <ValueType>(DocConstantModelName.VALUETYPE, request, GetValueType);