public void Load(bool IsFirstStart = false) { if (IsFirstStart) { _DB.Add(new MPerson() { Id = Guid.NewGuid().ToString(), VName = "Max", NName = "Mustermann", Mid = "001", TaughtNr = "", Stunden = new ObservableCollection <MStunden>() }); _DB.Add(new MPerson() { Id = Guid.NewGuid().ToString(), VName = "Maria", NName = "Mustermann", Mid = "002", TaughtNr = "", Stunden = new ObservableCollection <MStunden>() }); _DB.Add(new MPerson() { Id = Guid.NewGuid().ToString(), VName = "Nino", NName = "Mustermann", Mid = "003", TaughtNr = "001", Stunden = new ObservableCollection <MStunden>() }); _DB.Add(new MPerson() { Id = Guid.NewGuid().ToString(), VName = "Nena", NName = "Mustermann", Mid = "004", TaughtNr = "002", Stunden = new ObservableCollection <MStunden>() }); ObservableCollection <MPerson> mp = _DB.Load(); foreach (MPerson p in mp) { _DB.AddStunden(new MStunden() { Id = Guid.NewGuid().ToString(), Start = "01.01.2020 08:00", Ende = "01.01.2020 17:00", Pause = "1,0" }, p); } } Value.Clear(); ValueStunden.Clear(); foreach (MPerson p in _DB.Load()) { Value.Add(p); LoadStunden(p); } }
public Result Add(Request req) { dynamic data = JsonConvert.DeserializeObject(req.Data.ToString()); return(DBPerson.Add(data?.Name?.ToString(), data?.Position?.ToString())); }