public async Task <IHttpActionResult> CreateSelectionAnswerSet( int customerId, CreateSelectionAnswerSetRequestDto model ) { Guid result = await selectionAnswerSetHelper.Create(customerId, model); return(Created( new Uri(Request.RequestUri, result.ToString()), new PostResponseDto <Guid> { Id = result } )); }
/// <summary> /// Creates entity and saves data in datasource. /// </summary> /// <param name="customerId">The customer identifier.</param> /// <param name="model">The model.</param> /// <returns> /// Id of created entity /// </returns> public async Task <Guid> Create(int customerId, CreateSelectionAnswerSetRequestDto model) { var answerSet = Mapper.Map <SelectionAnswerSet>(model); answerSet.CustomerId = customerId; answerSet.Tags = await tagsService.BuildTagsList(customerId, model.Tags); var selectionAnswerChoices = model.SelectionAnswerChoices.ToList(); foreach (var answerDto in selectionAnswerChoices) { var answer = await this.MapSelectionAnswerChoice(answerDto, selectionAnswerChoices); answerSet.SelectionAnswerChoices.Add(answer); } var result = await this.selectionAnswerSetService.Create(answerSet); await UpdateCachedLists(customerId, result); return(result.Id); }
/// <summary> /// Creates the selection answer set. /// </summary> /// <param name="request">The request.</param> /// <param name="customerId">The customer identifier.</param> /// <param name="token">The token.</param> /// <returns></returns> public async Task <PostResponseDto <Guid> > CreateSelectionAnswerSet(CreateSelectionAnswerSetRequestDto request, int customerId, string token) { var url = string.Format("api/{0}/answer-sets/selection", customerId); return(await apiClient.SendRequestAsync <PostResponseDto <Guid> >(url, request, Method.POST, null, token)); }
/// <summary> /// Creates the selection answer set. /// </summary> /// <param name="request">The request.</param> /// <param name="customerId">The customer identifier.</param> /// <param name="token">The token.</param> /// <returns></returns> public async Task <PostResponseDto <Guid> > CreateSelectionAnswerSet(CreateSelectionAnswerSetRequestDto request, int customerId, string token) { return(await healthLibraryDataProvider.CreateSelectionAnswerSet(request, customerId, token)); }