public IViewPastBattls GetById(int id)
        {
            IViewPastBattls retorno    = new ViewPastBattls();
            string          sqlCommand = "viewPastBattlsFind";

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                IDataQuery query = new DataQuery();
                query.Where = string.Format(" BattlId={0} ", id);

                _dataBase.AddInParameter(dbCmd, "@fromParam", DbType.String, query.From);
                _dataBase.AddInParameter(dbCmd, "@whereParam", DbType.String, query.Where);
                _dataBase.AddInParameter(dbCmd, "@orderByParam", DbType.String, query.OrderBy);

                // Call the ExecuteReader method with the command.
                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        IViewPastBattls viewPastBattls = new ViewPastBattls();

                        viewPastBattls.BattlId             = Convert.ToInt32(reader["battlId"].ToString());
                        viewPastBattls.FirstArtistId       = Convert.ToInt32(reader["firstArtistId"].ToString());
                        viewPastBattls.FirstSongId         = Convert.ToInt32(reader["firstSongId"].ToString());
                        viewPastBattls.FirstSongName       = reader["firstSongName"].ToString();
                        viewPastBattls.FirstAlbumName      = reader["firstAlbumName"].ToString();
                        viewPastBattls.FirstArtistName     = reader["firstArtistName"].ToString();
                        viewPastBattls.SecondSongId        = Convert.ToInt32(reader["secondSongId"].ToString());
                        viewPastBattls.SecondSongName      = reader["secondSongName"].ToString();
                        viewPastBattls.SecondAlbumName     = reader["secondAlbumName"].ToString();
                        viewPastBattls.SecondArtistName    = reader["secondArtistName"].ToString();
                        viewPastBattls.FirstAlbumCover     = reader["firstAlbumCover"].ToString();
                        viewPastBattls.SecondAlbumCover    = reader["secondAlbumCover"].ToString();
                        viewPastBattls.TotalSecond         = Convert.ToInt32(reader["totalSecond"].ToString());
                        viewPastBattls.TotalFirst          = Convert.ToInt32(reader["totalFirst"].ToString());
                        viewPastBattls.FirstSoundCloudUrl  = reader["firstSoundCloudUrl"].ToString();
                        viewPastBattls.SecondSoundCloudUrl = reader["secondSoundCloudUrl"].ToString();

                        viewPastBattls.Active = Convert.ToBoolean(reader["active"].ToString());
                        _collection.Add(viewPastBattls);

                        retorno = viewPastBattls;
                    }
                }
            }

            return(retorno);
        }
        public IList <IViewPastBattls> GetTop <IViewPastBattlsQueryParams>(int top, IViewPastBattlsQueryParams query)
        {
            _collection = new List <IViewPastBattls>();
            string sqlCommand = "viewPastBattlsGetTop";

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                _dataBase.AddInParameter(dbCmd, "@topParam", DbType.Int32, top);
                _dataBase.AddInParameter(dbCmd, "@fromParam", DbType.String, ((IDataQuery)query).From);
                _dataBase.AddInParameter(dbCmd, "@whereParam", DbType.String, ((IDataQuery)query).Where);
                _dataBase.AddInParameter(dbCmd, "@orderByParam", DbType.String, ((IDataQuery)query).OrderBy);

                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        IViewPastBattls viewPastBattls = new ViewPastBattls();

                        viewPastBattls.BattlId             = Convert.ToInt32(reader["battlId"].ToString());
                        viewPastBattls.FirstSongId         = Convert.ToInt32(reader["firstSongId"].ToString());
                        viewPastBattls.FirstAlbumId        = Convert.ToInt32(reader["firstAlbumId"].ToString());
                        viewPastBattls.FirstArtistId       = Convert.ToInt32(reader["firstArtistId"].ToString());
                        viewPastBattls.FirstSongName       = reader["firstSongName"].ToString();
                        viewPastBattls.FirstAlbumName      = reader["firstAlbumName"].ToString();
                        viewPastBattls.FirstArtistName     = reader["firstArtistName"].ToString();
                        viewPastBattls.SecondSongId        = Convert.ToInt32(reader["secondSongId"].ToString());
                        viewPastBattls.SecondAlbumId       = Convert.ToInt32(reader["secondAlbumId"].ToString());
                        viewPastBattls.SecondArtistId      = Convert.ToInt32(reader["secondArtistId"].ToString());
                        viewPastBattls.SecondSongName      = reader["secondSongName"].ToString();
                        viewPastBattls.SecondAlbumName     = reader["secondAlbumName"].ToString();
                        viewPastBattls.SecondArtistName    = reader["secondArtistName"].ToString();
                        viewPastBattls.FirstAlbumCover     = reader["firstAlbumCover"].ToString();
                        viewPastBattls.SecondAlbumCover    = reader["secondAlbumCover"].ToString();
                        viewPastBattls.FirstSoundCloudUrl  = reader["firstSoundCloudUrl"].ToString();
                        viewPastBattls.SecondSoundCloudUrl = reader["secondSoundCloudUrl"].ToString();

                        viewPastBattls.Active = Convert.ToBoolean(reader["active"].ToString());
                        _collection.Add(viewPastBattls);
                    }
                }
            }

            return(_collection);
        }
        public IList <IViewPastBattls> Find <IViewPastBattlsQueryParams>(IViewPastBattlsQueryParams query)
        {
            _collection = new List <IViewPastBattls>();
            string sqlCommand = "viewPastBattlsFind";

            // Create a suitable command type and add the required parameter.
            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                _dataBase.AddInParameter(dbCmd, "@fromParam", DbType.String, ((IDataQuery)query).From);
                _dataBase.AddInParameter(dbCmd, "@whereParam", DbType.String, ((IDataQuery)query).Where);
                _dataBase.AddInParameter(dbCmd, "@orderByParam", DbType.String, ((IDataQuery)query).OrderBy);
                _dataBase.AddInParameter(dbCmd, "@pageNumber", DbType.String, ((IDataQuery)query).Page);
                _dataBase.AddInParameter(dbCmd, "@rowCount", DbType.String, ((IDataQuery)query).RowCount);

                // Call the ExecuteReader method with the command.
                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        IViewPastBattls viewPastBattls = new ViewPastBattls();

                        viewPastBattls.BattlId             = Convert.ToInt32(reader["battlId"].ToString());
                        viewPastBattls.FirstArtistId       = Convert.ToInt32(reader["firstArtistId"].ToString());
                        viewPastBattls.FirstSongName       = reader["firstSongName"].ToString();
                        viewPastBattls.FirstAlbumName      = reader["firstAlbumName"].ToString();
                        viewPastBattls.FirstArtistName     = reader["firstArtistName"].ToString();
                        viewPastBattls.SecondSongId        = Convert.ToInt32(reader["secondSongId"].ToString());
                        viewPastBattls.SecondSongName      = reader["secondSongName"].ToString();
                        viewPastBattls.SecondAlbumName     = reader["secondAlbumName"].ToString();
                        viewPastBattls.SecondArtistName    = reader["secondArtistName"].ToString();
                        viewPastBattls.FirstAlbumCover     = reader["firstAlbumCover"].ToString();
                        viewPastBattls.SecondAlbumCover    = reader["secondAlbumCover"].ToString();
                        viewPastBattls.TotalSecond         = Convert.ToInt32(reader["totalSecond"].ToString());
                        viewPastBattls.TotalFirst          = Convert.ToInt32(reader["totalFirst"].ToString());
                        viewPastBattls.FirstSoundCloudUrl  = reader["firstSoundCloudUrl"].ToString();
                        viewPastBattls.SecondSoundCloudUrl = reader["secondSoundCloudUrl"].ToString();
                        viewPastBattls.Active = Convert.ToBoolean(reader["active"].ToString());
                        _collection.Add(viewPastBattls);
                    }
                }
            }

            return(_collection);
        }