I want to add 'Priority' column.
- change database
Priority int column in TodoItems table, default value 0
getItems
- change view
site.js
function getItems() {
displayLoading();
fetch(uri)
.then(response => response.json())
.then((data) => {
hideLoading();
_displayItems(data);
applyCompletedCss();
})
.catch(error => console.error('Unable to get items.', error));
}
function _displayItems() {
...
let tdPri = tr.insertCell(2);
let textNodePri = document.createTextNode(item.priority);
tdPri.appendChild(textNodePri);
- change model
- change controller
TodoItemsController.cs >> no change
When everything is good, GET works and it shows.
Errors
When priority is null you have below two errors.
GET https://localhost:7147/api/todoitems 500
site.js:15 Unable to get items. SyntaxError: Unexpected token S in JSON at position 0
If database is bigint and vs code is int, you have below error.
InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.Int32'.
No comments:
Post a Comment