|
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 |
|
@@ -132,14 +132,14 @@ public async Task<ActionResult> MarkFixedAsync(string ids, string? version = nul |
132 | 132 | [HttpPost("mark-fixed")] |
133 | 133 | [Consumes("application/json")] |
134 | 134 | [ApiExplorerSettings(IgnoreApi = true)] |
135 | | - public async Task<ActionResult> MarkFixedAsync(JObject data) |
| 135 | + public async Task<ActionResult> MarkFixedAsync(JsonDocument data) |
136 | 136 | { |
137 | 137 | string? id = null; |
138 | | - if (data.TryGetValue("ErrorStack", out var value)) |
139 | | - id = value.Value<string>(); |
| 138 | + if (data.RootElement.TryGetProperty("ErrorStack", out var errorStackProp)) |
| 139 | + id = errorStackProp.GetString(); |
140 | 140 |
|
141 | | - if (data.TryGetValue("Stack", out value)) |
142 | | - id = value.Value<string>(); |
| 141 | + if (data.RootElement.TryGetProperty("Stack", out var stackProp)) |
| 142 | + id = stackProp.GetString(); |
143 | 143 |
|
144 | 144 | if (String.IsNullOrEmpty(id)) |
145 | 145 | return NotFound(); |
@@ -217,22 +217,22 @@ public async Task<IActionResult> AddLinkAsync(string id, ValueFromBody<string?> |
217 | 217 | [HttpPost("add-link")] |
218 | 218 | [Consumes("application/json")] |
219 | 219 | [ApiExplorerSettings(IgnoreApi = true)] |
220 | | - public async Task<IActionResult> AddLinkAsync(JObject data) |
| 220 | + public async Task<IActionResult> AddLinkAsync(JsonDocument data) |
221 | 221 | { |
222 | 222 | string? id = null; |
223 | | - if (data.TryGetValue("ErrorStack", out var value)) |
224 | | - id = value.Value<string>(); |
| 223 | + if (data.RootElement.TryGetProperty("ErrorStack", out var errorStackProp)) |
| 224 | + id = errorStackProp.GetString(); |
225 | 225 |
|
226 | | - if (data.TryGetValue("Stack", out value)) |
227 | | - id = value.Value<string>(); |
| 226 | + if (data.RootElement.TryGetProperty("Stack", out var stackProp)) |
| 227 | + id = stackProp.GetString(); |
228 | 228 |
|
229 | 229 | if (String.IsNullOrEmpty(id)) |
230 | 230 | return NotFound(); |
231 | 231 |
|
232 | 232 | if (id.StartsWith("http")) |
233 | 233 | id = id.Substring(id.LastIndexOf('/') + 1); |
234 | 234 |
|
235 | | - string? url = data.GetValue("Link")?.Value<string>(); |
| 235 | + string? url = data.RootElement.TryGetProperty("Link", out var linkProp) ? linkProp.GetString() : null; |
236 | 236 | return await AddLinkAsync(id, new ValueFromBody<string?>(url)); |
237 | 237 | } |
238 | 238 |
|
|
0 commit comments