|
21 | 21 | using McSherry.SemanticVersioning; |
22 | 22 | using Microsoft.AspNetCore.Authorization; |
23 | 23 | using Microsoft.AspNetCore.Mvc; |
24 | | -using Newtonsoft.Json.Linq; |
| 24 | +using System.Text.Json; |
25 | 25 |
|
26 | 26 | namespace Exceptionless.Web.Controllers; |
27 | 27 |
|
@@ -131,14 +131,14 @@ public async Task<ActionResult> MarkFixedAsync(string ids, string? version = nul |
131 | 131 | [HttpPost("mark-fixed")] |
132 | 132 | [Consumes("application/json")] |
133 | 133 | [ApiExplorerSettings(IgnoreApi = true)] |
134 | | - public async Task<ActionResult> MarkFixedAsync(JObject data) |
| 134 | + public async Task<ActionResult> MarkFixedAsync(JsonDocument data) |
135 | 135 | { |
136 | 136 | string? id = null; |
137 | | - if (data.TryGetValue("ErrorStack", out var value)) |
138 | | - id = value.Value<string>(); |
| 137 | + if (data.RootElement.TryGetProperty("ErrorStack", out var errorStackProp)) |
| 138 | + id = errorStackProp.GetString(); |
139 | 139 |
|
140 | | - if (data.TryGetValue("Stack", out value)) |
141 | | - id = value.Value<string>(); |
| 140 | + if (data.RootElement.TryGetProperty("Stack", out var stackProp)) |
| 141 | + id = stackProp.GetString(); |
142 | 142 |
|
143 | 143 | if (String.IsNullOrEmpty(id)) |
144 | 144 | return NotFound(); |
@@ -215,22 +215,22 @@ public async Task<IActionResult> AddLinkAsync(string id, ValueFromBody<string?> |
215 | 215 | [HttpPost("add-link")] |
216 | 216 | [Consumes("application/json")] |
217 | 217 | [ApiExplorerSettings(IgnoreApi = true)] |
218 | | - public async Task<IActionResult> AddLinkAsync(JObject data) |
| 218 | + public async Task<IActionResult> AddLinkAsync(JsonDocument data) |
219 | 219 | { |
220 | 220 | string? id = null; |
221 | | - if (data.TryGetValue("ErrorStack", out var value)) |
222 | | - id = value.Value<string>(); |
| 221 | + if (data.RootElement.TryGetProperty("ErrorStack", out var errorStackProp)) |
| 222 | + id = errorStackProp.GetString(); |
223 | 223 |
|
224 | | - if (data.TryGetValue("Stack", out value)) |
225 | | - id = value.Value<string>(); |
| 224 | + if (data.RootElement.TryGetProperty("Stack", out var stackProp)) |
| 225 | + id = stackProp.GetString(); |
226 | 226 |
|
227 | 227 | if (String.IsNullOrEmpty(id)) |
228 | 228 | return NotFound(); |
229 | 229 |
|
230 | 230 | if (id.StartsWith("http")) |
231 | 231 | id = id.Substring(id.LastIndexOf('/') + 1); |
232 | 232 |
|
233 | | - string? url = data.GetValue("Link")?.Value<string>(); |
| 233 | + string? url = data.RootElement.TryGetProperty("Link", out var linkProp) ? linkProp.GetString() : null; |
234 | 234 | return await AddLinkAsync(id, new ValueFromBody<string?>(url)); |
235 | 235 | } |
236 | 236 |
|
|
0 commit comments