private bool TestDiplomaIfEmpty() { DiplomaContext context = new DiplomaContext(); IEnumerable <Diploma> queryDiploma = context.Diplomas; int countDiploma = queryDiploma.Count(); return(countDiploma <= 0 ? true : false); }
public void setDiplomas() { if (TestDiplomaIfEmpty()) { DiplomaContext context = new DiplomaContext(); foreach (Student st in StudentData.testStudents) { context.Diplomas.Add(new Diploma(st.facultyNumber)); } context.SaveChanges(); } }
private void Button_Click_4(object sender, RoutedEventArgs e) { DiplomaContext context = new DiplomaContext(); Diploma result = (from dp in context.Diplomas where dp.student == tempuser.facultyNumber select dp).First(); DialogDipl dialog = new DialogDipl("Vuvedete tema", "Web sait"); if (dialog.ShowDialog() == true) { result.topic = dialog.Answer; } diplomaTxt.Text = result.topic; context.SaveChanges(); // promenite se zapazvat v bazata danni mojete da runete query }
public void Populate(object obj) { FirstName = st.firstName; SureName = st.sureName; LastName = st.lastName; Faculty = st.faculty; Specialnost = st.specialnost; Oks = st.major; Status = st.status; FacNumber = st.facultyNumber; Course = Convert.ToString(st.course); Potok = Convert.ToString(st.potok); Group = Convert.ToString(st.group); DiplomaContext context = new DiplomaContext(); Diploma result = (from dp in context.Diplomas where dp.student == st.facultyNumber select dp).First(); Diploma = result.topic; }