public void UpdateObject(MamaCheck mama) { using (var db = new SQLiteConnection(dbPath)) { //var existing = db.Query<MamaCheck>("select * from MamaCheck where Week = "+mama.Week).FirstOrDefault(); db.RunInTransaction(() => { db.Update(mama); }); } }
//method nay danh cho tu van thuc pham public double BMRIndex(int week) { MamaCheck _mamacheck = new MamaCheck(); PMamaCheck _check = new PMamaCheck(); if(week >= 1) { _mamacheck = _check.GetObject(week); } else { return 0; } return 0.00; }
public new ObservableCollection<MamaCheck> GetListObject() { using (var db = new SQLiteConnection(dbPath)) { MamaCheck temp = new MamaCheck(); List<MamaCheck> obCollection = db.Table<MamaCheck>().ToList<MamaCheck>(); for (int i = 0, j = obCollection.Count - 1; i < obCollection.Count; ++i) { if (i < obCollection.Count / 2) { temp = obCollection[i]; obCollection[i] = obCollection[j]; obCollection[j] = temp; } } ObservableCollection<MamaCheck> mamaList = new ObservableCollection<MamaCheck>(obCollection); return mamaList; } }