This is my table: Statistics
Id,Depth,RefreshCounter
Examples of entries:
Id Depth RefreshCounter 1 1 1 2 1 0 3 1 0 4 1 0
Now I need to do when I refresh the page, I need to increase this refreshcounter value by 1 in the database table using Depth 1 .
I call this method as follows when loading my view page:
@Html.Action("IncrementRefreshcounter", "Statistics", new { id = 1}) //for eg:1,2,3,4
Here is my code that does this:
[ChildActionOnly] public ActionResult IncrementRefreshcounter(int id) { using ( var context = new MyDBContext()) {
I call this method when my View Loads.Problem is when I launch my application for the first time and call this method, it successfully updated RefreshCounter to 1, but after that, when I refresh my page and calling this method, it never refreshes RefreshCounter for any record with depth = 1.
In my recording example, you can see that Id 1 with Depth 1 has an update counter with a value of 1, because this was the first time I launched my application and it successfully updated this value, but after that it never updates the value for example: Id 2 Depth 1
It increases only 1 time by RefreshCounter, but after that it never increases this variable.
Can someone tell me what the problem is SaveChangesAsync ??