public virtual async Task <ActionResult <T2> > CopyFromChangeset(T1 entityId, Guid changesetId)
        {
            try
            {
                var createdEntity = await _historicalCrudService.CopyFromChangeset(entityId, changesetId);

                return(CreatedAtAction(nameof(GetById), new { id = createdEntity.Id }, createdEntity));
            }
            catch (Exception ex)
            {
                if (ex is EntityNotFoundException)
                {
                    return(NotFound($"Entity not found with id: {entityId}"));
                }
                if (ex is ChangesetNotFoundException)
                {
                    return(NotFound($"Changeset not found with id: {changesetId}"));
                }
                return(BadRequest("Unable to process request for unknown reason."));
            }
        }
Beispiel #2
0
 public virtual async Task <T> CopyFromChangeset(Guid entityId, Guid changesetId) => await _service.CopyFromChangeset(entityId, changesetId);
Beispiel #3
0
 public virtual async Task <TDto> CopyFromChangeset(TId entityId, Guid changesetId) => _mapper.Map <TDto>(await _service.CopyFromChangeset(entityId, changesetId));