Here is my code:
var items = tableInDatabase.All("WHERE [Order] > " + order);
foreach (var i in items.ToArray())
{
i.Order = 7;
}
tableInDatabase.Save(items.ToArray());
However, when the breakpoint comes to the last line (after the foreach loop), every element of items has an order the same as before (not 7). Why is this happening?
While still in the loop, i has an order of 7.
I’m using Massive, and this is the example from its official page:
var table = new Products();
var drinks = table.All("WHERE CategoryID = 8");
foreach(var item in drinks.ToArray()){
item.CategoryID = 12;
}
table.Save(drinks.ToArray());
I also tried:
foreach (var i in items.ToArray())
{
tableInDatabase.Update(i, i.Id);
}
And nothing.
The return type od tableInDatabase is the class TableInDatabase. This is the definition:
public TableInDatabase() : base(connectionString, "System.Data.SqlClient", "TableInDatabase", "Id") { }
use this code: