public Announcement CreateAnnouncementFromReader(IReaderAdapter reader) { ThrowIfArgumentNull(reader, nameof(reader)); var text = reader.GetString("Text"); var timestamp = reader.GetDateTime("Timestamp"); var category = reader.GetString("Category"); var user = CreateUserFromReader(reader); var announcement = Announcement.Create(timestamp, user, text, category); return(announcement); }
public User CreateUserFromReader(IReaderAdapter reader) { ThrowIfArgumentNull(reader, nameof(reader)); var id = reader.GetInt("User_ID"); var username = reader.GetString("Username"); var firstName = reader.GetString("First_Name"); var lastName = reader.GetString("Last_Name"); var role = reader.GetString("Role"); var email = reader.GetString("Email"); return(new User(id, firstName, lastName, username, role, email)); }