public async Task <IActionResult> DeleteInventory([FromRoute] int id, [FromRoute] string timestamp) { if (!timestamp.StartsWith("\"")) { timestamp = $"\"{timestamp}\""; } var ts = JsonConvert.DeserializeObject <byte[]>(timestamp); _repo.Delete(id, ts); return(Ok()); }
public async Task <IActionResult> Delete([Bind("Id,Timestamp")] Inventory inventory) { try { _context.Delete(inventory); } catch (DbUpdateConcurrencyException ex) { ModelState.AddModelError(string.Empty, $@"Unable to delete record. Another user updated the record, {ex.Message}"); } catch (Exception ex) { ModelState.AddModelError(string.Empty, $@"Unable to delete record. {ex.Message}"); } return(RedirectToAction(nameof(Index))); }