Пример #1
0
        public async Task <GetAnonymousDropDownListResponse> GetAnonymousDropDown(GetAnonymousDropDownListRequest request, string url = null)
        {
            string jsonRequest = JsonSerializer.Serialize(request);

            var response = await GetFromCache <GetAnonymousDropDownListResponse>(jsonRequest);

            if (response != null)
            {
                return(response);
            }

            response = await PollyHelpers.ExecutePolicyAsync
                       (
                () => this.factory.PostAsync <GetAnonymousDropDownListResponse>
                (
                    url ?? "api/Dropdown/GetAnonymousDropdown",
                    jsonRequest,
                    App.BASE_URL
                )
                       );

            await AddToCache(jsonRequest, response);

            return(response);
        }
Пример #2
0
 public Task <BaseResponse> GetEntity(GetEntityRequest request, string url = null)
 => PollyHelpers.ExecutePolicyAsync
 (
     () => this.factory.PostAsync <BaseResponse>
     (
         url ?? "api/Entity/GetEntity",
         JsonSerializer.Serialize(request),
         App.BASE_URL
     )
 );
Пример #3
0
 public Task <BaseResponse> SaveEntity(SaveEntityRequest request, string url)
 => PollyHelpers.ExecutePolicyAsync
 (
     () => this.factory.PostAsync <BaseResponse>
     (
         url,
         JsonSerializer.Serialize(request),
         App.BASE_URL
     )
 );
Пример #4
0
        public async Task <BaseResponse> GetObjectDropDown(GetTypedListRequest request, string url = null)
        {
            string jsonRequest = JsonSerializer.Serialize(request);
            var    response    = await GetFromCache <GetListResponse>(jsonRequest);

            if (response?.Success == true && response.List != null)
            {
                return(response);
            }

            response = await PollyHelpers.ExecutePolicyAsync
                       (
                () => this.factory.PostAsync <GetListResponse>
                (
                    url ?? "api/List/GetList",
                    jsonRequest,
                    App.BASE_URL
                )
                       );

            await AddToCache(jsonRequest, response);

            return(response);
        }