/// <summary> /// Creates / Edits an article property. /// </summary> /// <param name="value">The article property.</param> /// <param name="token">The token.</param> /// <returns> /// A task that represents the asynchronous operation. /// The task result contains the new article 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 <ArticleProperty> EditPropertyAsync(ArticleProperty value, CancellationToken token = default) { if (value == null || value.ArticleId <= 0 || value.ArticlePropertyId <= 0 || value.Value == null) { throw new ArgumentException("any parameter was not set", nameof(value)); } var wrappedModel = new ArticlePropertyWrapper { ArticleProperty = value.ToApi() }; try { var jsonModel = await PostAsync("/api/article-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); } }
internal static ArticleProperty ToDomain(this ArticlePropertyWrapper value) { return(s_articlePropertyMapper.ApiToDomain(value)); }
public ArticleProperty ApiToDomain(ArticlePropertyWrapper value) { return(ApiToDomain(value?.ArticleProperty)); }
internal static ArticleProperty ToDomain(this ArticlePropertyWrapper value) { return(value?.ArticleProperty.ToDomain()); }