コード例 #1
0
        public string GetData(int confId, UserPublicModel currentUser)
        {
            var conf = _widgetConfRepository.GetWidgetConfById(confId);

            if (conf == null || conf.UserId != currentUser.Id)
            {
                return(null);
            }
            var widget = _widgetRepository.GetWidgetById(conf.WidgetId);

            if (widget == null)
            {
                return(null);
            }
            var service = _serviceRepository.GetServiceById(widget.ServiceId);

            if (service == null)
            {
                return(null);
            }
            var provider = _providerRepository.GetProviderById(service.ProvId);

            if (provider == null)
            {
                return(null);
            }
            var(route, method, form, token) = ParsConf(conf.Conf, provider);
            if (route == null || method == null)
            {
                return(null);
            }

            return(method switch
            {
                "get" => _workerRepository.Get(route, token),
                "post" => _workerRepository.Post(route, form, token),
                _ => null
            });
コード例 #2
0
 public WidgetModel GetWidgetById(uint id)
 {
     return(_widgetRepository.GetWidgetById(id));
 }