Skip to content

Instantly share code, notes, and snippets.

Last active May 9, 2020
What would you like to do?
See the blog post here:
// DELETE api/v1/author/{authorId}
/// <summary>
/// Deletes an Author
/// </summary>
/// <remarks>Deletes an Author</remarks>
/// <param name="authorId"></param>
[HttpDelete("{authorId:length(24)}", Name = nameof(DeleteAuthor))]
[ProducesResponseType(typeof(DeleteModel<>), StatusCodes.Status200OK)]
public async Task<IActionResult> DeleteAuthor(string authorId)
var author = await _unitOfWork.Library.GetAuthorById(authorId);
if (author == null)
return NotFound();
var undoObject = new DeleteModel<string> { ResourceId = authorId };
_memoryCache.Set(authorId, author, undoObject.ExpireTime);
await _unitOfWork.Commit();
return Ok(undoObject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment