/// <summary> /// Creates / Edits a client property. /// </summary> /// <param name="value">The client property.</param> /// <param name="token">The token.</param> /// <returns> /// A task that represents the asynchronous operation. /// The task result contains the new client property. /// </returns> /// <exception cref="ArgumentException">Thrown when the parameter check fails.</exception> /// <exception cref="NotAuthorizedException">Thrown when not authorized to access this resource.</exception> /// <exception cref="NotFoundException">Thrown when the resource url could not be found.</exception> public async Task <ClientProperty> EditAsync(ClientProperty value, CancellationToken token = default) { if (value == null) { throw new ArgumentNullException(nameof(value)); } if (value.ClientId == 0 || value.ClientPropertyId == 0 || value.Value == null) { throw new ArgumentException("required value of the client invalid", nameof(value)); } if (value.Id != 0) { throw new ArgumentException("invalid id", nameof(value)); } var wrappedModel = new ClientPropertyWrapper { ClientProperty = value.ToApi() }; try { var jsonModel = await PostAsync("/api/client-property-values", wrappedModel, token).ConfigureAwait(false); return(jsonModel.ToDomain()); } catch (WebException wex) when(wex.Status == WebExceptionStatus.ProtocolError && (wex.Response as HttpWebResponse)?.StatusCode == HttpStatusCode.BadRequest) { throw new ArgumentException("wrong input parameter", nameof(value), wex); } }
Task <ClientProperty> IEntityPropertyService <ClientProperty, ClientPropertyFilter> .EditPropertyAsync(ClientProperty value, CancellationToken token) { throw new NotImplementedException(); }