public async Task ReadPlatesAsync() { using (CVContext db = new CVContext()) { //Console.WriteLine("9999"); var plates = await(from c in db.Plates select c).ToListAsync(); foreach (var c in plates) { PlatesFromDB.Add(c.Path + " : " + c.Count); } } }
public async Task WritePlatesAsync(Dictionary <string, int> dict) { using (CVContext db = new CVContext()) { foreach (KeyValuePair <string, int> item in dict) { PlateNumber plateNumber = new PlateNumber(); plateNumber.Path = item.Key; plateNumber.Count = item.Value; db.Plates.Add(plateNumber); } //Console.WriteLine("88888"); await db.SaveChangesAsync(); } }
public async Task WriteCatsAsync(Dictionary <string, int> dict) { using (CVContext db = new CVContext()) { foreach (KeyValuePair <string, int> item in dict) { Cat cat = new Cat(); cat.Path = item.Key; cat.Count = item.Value; db.Cats.Add(cat); } //Console.WriteLine("88888"); await db.SaveChangesAsync(); } }