public Location SelectByID(int id) { if (locations == null) { LocationDB db = new LocationDB(); locations = db.SelectAll(); } Location loc = locations.Find(c => c.ID == id); return(loc); }
protected override BaseEntity CreateModel(BaseEntity entity) { Comments com = entity as Comments; com.ID = (int)reader["ID"]; PersonDB db = new PersonDB(); com.Creator = db.SelectById((int)reader["Creator"]); com.Comment = reader["Comment"].ToString(); com.Cdate = (DateTime)reader["Datee"]; LocationDB dbl = new LocationDB(); com.Loc = dbl.SelectByID((int)reader["Location"]); return(com); }