/// <summary> /// Updates the localized strings. /// </summary> /// <param name="customerId">The customer identifier.</param> /// <param name="scaleAnswerSetId">The scale answer set identifier.</param> /// <param name="model">The model.</param> /// <param name="language">The language.</param> /// <returns></returns> public async Task <UpdateScaleAnswerSetLocalization> UpdateLocalizedStrings( int customerId, Guid scaleAnswerSetId, UpdateScaleAnswerSetLocalizedRequestDto model, string language ) { var lowLabel = await MapUpdatingLabelToLocalizedString <LowLabelScaleAnswerSetString>(model.LowLabel, language); MidLabelScaleAnswerSetString midLabel = null; if (model.MidLabel != null && model.MidLabel.Value != null) { midLabel = await MapUpdatingLabelToLocalizedString <MidLabelScaleAnswerSetString>(model.MidLabel, language); } var highLabel = await MapUpdatingLabelToLocalizedString <HighLabelScaleAnswerSetString>(model.HighLabel, language); var status = await scaleAnswerSetService.UpdateLabels(customerId, scaleAnswerSetId, lowLabel, midLabel, highLabel); return(status); }
public async Task <IHttpActionResult> UpdateScaleAnswerSetLocalizedStrings( int customerId, Guid scaleAnswerSetId, UpdateScaleAnswerSetLocalizedRequestDto model, string language ) { var status = await scaleAnswerSetHelper.UpdateLocalizedStrings(customerId, scaleAnswerSetId, model, language); if (status == UpdateScaleAnswerSetLocalization.NotFound) { return(Content( HttpStatusCode.NotFound, new ErrorResponseDto() { Error = ErrorCode.InvalidRequest, Message = ErrorCode.InvalidRequest.Description(), Details = status.GetConcatString() } )); } if (!status.HasFlag(UpdateScaleAnswerSetLocalization.Success)) { return(Content( HttpStatusCode.BadRequest, new ErrorResponseDto() { Error = ErrorCode.InvalidRequest, Message = ErrorCode.InvalidRequest.Description(), Details = status.GetConcatString() } )); } return(StatusCode(HttpStatusCode.NoContent)); }