Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created June 21, 2018 00:55
Show Gist options
  • Save dcomartin/0974d9736789ccc080e6019282f7dbf6 to your computer and use it in GitHub Desktop.
Save dcomartin/0974d9736789ccc080e6019282f7dbf6 to your computer and use it in GitHub Desktop.
public IActionResult AddToAccount()
{
var problem = new OutOfCreditProblemDetails
{
Type = "https://example.com/probs/out-of-credit",
Title = "You do not have enough credit.",
Detail = "Your current balance is 30, but that costs 50.",
Instance = "/account/12345/msgs/abc",
Balance = 30.0m,
Accounts = { "/account/12345","/account/67890" }
};
return BadRequest(problem);
}
public class OutOfCreditProblemDetails : Microsoft.AspNetCore.Mvc.ProblemDetails
{
public OutOfCreditProblemDetails()
{
Accounts = new List<string>();
}
public decimal Balance { get; set; }
public ICollection<string> Accounts { get; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment