public void UpdateList(int _UserId) { List <ForeingBox> list = new List <ForeingBox>(); using (var connSQLite = new SQLite.SQLiteConnection(App.root_db)) { list = connSQLite.Query <ForeingBox>("select * from ForeingBox where ForeingBox.UserId = " + _UserId + " and ForeingBox.UserRecivedId = " + MainViewModel.GetInstance().User.UserId); } foreach (ForeingBox foreing in list) { int findValue = foreing.BoxId; int newIndex = 0; for (int i = 0; i < ForeingBox.Count; i++) { if (ForeingBox[i].BoxId == findValue && ForeingBox[i].UserRecivedId == MainViewModel.GetInstance().User.UserId) { newIndex = i; } } ForeingBox.RemoveAt(newIndex); ForeingBox.Insert(newIndex, foreing); } }
public void UpdateList(ForeingBox _foreingBoxOld, ForeingBox _foreingBoxNew) { int findValue = _foreingBoxOld.BoxId; int newIndex = 0; for (int i = 0; i < ForeingBox.Count; i++) { if (ForeingBox[i].BoxId == findValue && ForeingBox[i].UserRecivedId == MainViewModel.GetInstance().User.UserId) { newIndex = i; } } ForeingBox.RemoveAt(newIndex); ForeingBox.Insert(newIndex, _foreingBoxNew); }