Exemplo n.º 1
0
        public async Task <bool> UpdateService(CreateServiceDto service, Guid uuid)
        {
            var request  = JsonConvert.SerializeObject(service);
            var response = await HttpClient.PutAsync(string.Format(BusinessmanServiceUri, uuid), new StringContent(request, Encoding.UTF8, ApplicationJson));

            var json = await response.Content.ReadAsStringAsync();

            Debug.WriteLine(json);
            var data = JsonConvert.DeserializeObject <ResponseDto <object> >(json);

            if (data.Success)
            {
                MyServicesListChanged?.Invoke(this, EventArgs.Empty);
            }
            return(data.Success);
        }
Exemplo n.º 2
0
        public async Task <bool> CreateService(CreateServiceDto createServiceDto)
        {
            var request  = JsonConvert.SerializeObject(createServiceDto);
            var response = await HttpClient.PostAsync(BusinessmanServicesUri, new StringContent(request, Encoding.UTF8, ApplicationJson));

            var json = await response.Content.ReadAsStringAsync();

            Debug.WriteLine(json);
            if (string.IsNullOrEmpty(json))
            {
                return(false);
            }
            var data = JsonConvert.DeserializeObject <ResponseDto <object> >(json);

            if (data.Success)
            {
                MyServicesListChanged?.Invoke(this, EventArgs.Empty);
            }
            return(data.Success);
        }