Esempio n. 1
0
        public async Task DeleteAndUploadAsync(CianData data)
        {
            ODataSelectCianRecord taskDelete = await Delete(data);

            IFlurlResponse taskUpload = await Upload(data);

            async Task <IFlurlResponse> Upload(CianData data)
            {
                return(await UploadAsync(data).ConfigureAwait(false));
            }

            async Task <ODataSelectCianRecord> Delete(CianData data)
            {
                ODataSelectCianRecord responseSelect = await SelectAsync <ODataSelectCianRecord>(data).ConfigureAwait(false);

                foreach (ODataSelectCianRecordValue itemRecord in responseSelect.Value)
                {
                    IFlurlResponse responseDelete = await DeleteAsync(new Guid(itemRecord.AdCian)).ConfigureAwait(false);
                }

                return(responseSelect);
            }
        }
Esempio n. 2
0
 private async Task <IFlurlResponse> UploadAsync(CianData data)
 {
     return(await _odata.WithOAuthBearerToken(token.Content).PostJsonAsync(data).ConfigureAwait(false));
 }
Esempio n. 3
0
 private async Task <T> SelectAsync <T>(CianData data)
 {
     return(await $"{_odata}?$select=cianid,flaturl&$filter=flaturl eq '{data.FlatUrl}'".WithOAuthBearerToken(token.Content).GetJsonAsync <T>().ConfigureAwait(false));
 }