public subject GetSubject(int id) { subject subject = new subject(); try { subject = db.subjects.SingleOrDefault(x => x.id_subject == id); } catch (Exception e) { Console.WriteLine(e); } return(subject); }
public bool AddSubject(string subject_name) { var subject = new subject(); subject.subject_name = subject_name; try { db.subjects.Add(subject); db.SaveChanges(); } catch (Exception e) { Console.WriteLine(e); return(false); } return(true); }