public async Task <ActionResult> AddAsync( [FromBody] List <PurchaseOrderDetail> purchaseOrderDetails, CancellationToken cancellationToken) { InitUserInfo(); if (!AllowCreate && !AllowUpdate) { return(ValidationProblem()); } var newItems = purchaseOrderDetails.Select(_mapper.Map <PurchaseOrderDetail>).ToList(); foreach (var item in newItems) { CleanReferenceObject(item); } newItems = await _purchaseOrderDetailService.AddDraftAsync(newItems, cancellationToken); if (newItems == null) { AssignToModelState(_purchaseOrderDetailService.Errors); return(ValidationProblem()); } return(CreatedAtAction(nameof(GetIdAsync), new { id = newItems[0].Id }, null)); }