async void addNewTime() { int index = GetDrugIndex(); try { System.Diagnostics.Debug.WriteLine(DoseTime.ToString()); Cas_Davkovania davk = new Cas_Davkovania() { Cas = DoseTime.ToString(), LiekyFK = index }; _context.DrugTakeTime.Add(davk); } catch (Exception e) { throw e; } try { _context.SaveChanges(); } catch (Exception f) { throw f; } LoadTimes(); }
private void loadDrug() { Lieky l = new Lieky { LiekId = 1, Nazov = "flector" }; Cas_Davkovania cd = new Cas_Davkovania { Cas = "2017-01-01T12:25:04Z", CasDavkovaniaId = 1, LiekyFK = 1 }; _context.Drugs.Add(l); _context.DrugTakeTime.Add(cd); try { _context.SaveChanges(); } catch (Exception e) { //throw e; } }