Skip to content

Instantly share code, notes, and snippets.

@bymyslf
Created February 12, 2018 08:44
Show Gist options
  • Save bymyslf/1a4b5005d2a0905596a3e9b1bd1355d9 to your computer and use it in GitHub Desktop.
Save bymyslf/1a4b5005d2a0905596a3e9b1bd1355d9 to your computer and use it in GitHub Desktop.
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
public class ConflictObjectResult : ObjectResult
{
public ConflictObjectResult(string detail)
: base(detail)
=> StatusCode = StatusCodes.Status409Conflict;
}
public static class ControllerExtensions
{
public static IActionResult Conflict(this Controller controller, string detail)
=> new ConflictObjectResult(detail);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment