Skip to content

Instantly share code, notes, and snippets.

Last active Apr 19, 2020
What would you like to do?
See the blog post here:
// POST api/v1/author/{authorId}/undo
/// <summary>
/// Undo a deleted action on Author
/// </summary>
/// <remarks>Undo a deleted action on Author</remarks>
/// <param name="authorId"></param>
[HttpPost("{authorId:length(24)}/undo", Name = nameof(UndoDeletedAuthor))]
public async Task<IActionResult> UndoDeletedAuthor(string authorId)
if (!_memoryCache.TryGetValue(authorId, out Author author))
return new StatusCodeResult(StatusCodes.Status410Gone);
await _unitOfWork.Commit();
var authorToReturn = _mapper.Map<AuthorDto>(author);
return CreatedAtAction(nameof(GetAuthor), new { authorId }, authorToReturn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment