Skip to content

Instantly share code, notes, and snippets.

@bymyslf
Last active February 9, 2018 09:00
Show Gist options
  • Select an option

  • Save bymyslf/edfeaaa72bf820f3210402283cca92fd to your computer and use it in GitHub Desktop.

Select an option

Save bymyslf/edfeaaa72bf820f3210402283cca92fd to your computer and use it in GitHub Desktop.
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
public class FailedPreconditionObjectResult : ObjectResult
{
public FailedPreconditionObjectResult(string detail)
: base(detail)
=> StatusCode = StatusCodes.Status412PreconditionFailed;
}
public static class ControllerExtensions
{
public static IActionResult FailedPrecondition(this Controller controller, string detail)
=> new FailedPreconditionObjectResult(detail);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment