public static ParentInfo GetParentInfo(int parentID) { using (SchoolJournalEntities context = new SchoolJournalEntities()) { Parent p = context.Set<Parent>().Find(parentID); if (p != null) { ParentInfo info = new ParentInfo(p); return info; } else throw new ArgumentOutOfRangeException("Parent ID was not found in the DB!"); } }
public static ParentInfo GetParentInfo(int parentID) { using (SchoolJournalEntities context = new SchoolJournalEntities()) { Parent p = context.Set <Parent>().Find(parentID); if (p != null) { ParentInfo info = new ParentInfo(p); return(info); } else { throw new ArgumentOutOfRangeException("Parent ID was not found in the DB!"); } } }