private List<Request> Read(DbDataReader reader) { List<Request> requests = new List<Request>(); while (reader.Read()) { SampleRequest er = new SampleRequest(); er.Id = reader.GetInt32(0); er.Type = reader.GetString(1); er.Description = reader.GetString(2); er.Created = reader.GetDateTime(3); requests.Add(er); } return requests; }
private void PrepareCommand(IDatabase db, DbCommand cmd, SampleRequest er) { cmd.Parameters.Add(db.CreateParameter("@type", "varchar", er.Type.Length)); cmd.Parameters["@type"].Value = er.Type; cmd.Parameters.Add(db.CreateParameter("@description", "varchar", er.Description.Length)); cmd.Parameters["@description"].Value = er.Description; cmd.Parameters.Add(db.CreateParameter("@date", "datetime")); cmd.Parameters["@date"].Value = er.Created; }