public IViewBattlResults GetById(int id)
        {
            IViewBattlResults viewBattlResults = new ViewBattlResults();
            string            sqlCommand       = "viewBattlResultsFind";

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                IDataQuery query = new DataQuery();
                query.Where = string.Format(" viewBattlResultsId = {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())
                    {
                        viewBattlResults.BattlId          = Convert.ToInt32(reader["battlId"].ToString());
                        viewBattlResults.FirstSongId      = Convert.ToInt32(reader["firstSongId"].ToString());
                        viewBattlResults.SecondSongId     = Convert.ToInt32(reader["secondSongId"].ToString());
                        viewBattlResults.ArtistNameSecond = reader["artistNameSecond"].ToString();
                        viewBattlResults.ArtistNameFirst  = reader["artistNameFirst"].ToString();
                        viewBattlResults.TotalSecond      = Convert.ToInt32(reader["totalSecond"].ToString());
                        viewBattlResults.TotalFirst       = Convert.ToInt32(reader["totalFirst"].ToString());
                        viewBattlResults.ProfileId        = Convert.ToInt32(reader["profileId"].ToString());
                        viewBattlResults.Active           = Convert.ToBoolean(reader["active"].ToString());
                    }
                }
            }


            return(viewBattlResults);
        }
        public IList <IViewBattlResults> GetTop <IViewBattlResultsQueryParams>(int top, IViewBattlResultsQueryParams query)
        {
            _collection = new List <IViewBattlResults>();
            string sqlCommand = "viewBattlResultsGetTop";

            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())
                    {
                        IViewBattlResults viewBattlResults = new ViewBattlResults();

                        viewBattlResults.BattlId          = Convert.ToInt32(reader["battlId"].ToString());
                        viewBattlResults.FirstSongId      = Convert.ToInt32(reader["firstSongId"].ToString());
                        viewBattlResults.SecondSongId     = Convert.ToInt32(reader["secondSongId"].ToString());
                        viewBattlResults.ArtistNameSecond = reader["artistNameSecond"].ToString();
                        viewBattlResults.ArtistNameFirst  = reader["artistNameFirst"].ToString();
                        viewBattlResults.TotalSecond      = Convert.ToInt32(reader["totalSecond"].ToString());
                        viewBattlResults.TotalFirst       = Convert.ToInt32(reader["totalFirst"].ToString());
                        viewBattlResults.ProfileId        = Convert.ToInt32(reader["profileId"].ToString());
                        viewBattlResults.Active           = Convert.ToBoolean(reader["active"].ToString());
                        _collection.Add(viewBattlResults);
                    }
                }
            }

            return(_collection);
        }
        public IList <IViewBattlResults> Find <IViewBattlResultsQueryParams>(IViewBattlResultsQueryParams query)
        {
            _collection = new List <IViewBattlResults>();
            string sqlCommand = "viewBattlResultsFind";

            // 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);

                // Call the ExecuteReader method with the command.
                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        IViewBattlResults viewBattlResults = new ViewBattlResults();

                        viewBattlResults.BattlId          = Convert.ToInt32(reader["battlId"].ToString());
                        viewBattlResults.FirstSongId      = Convert.ToInt32(reader["firstSongId"].ToString());
                        viewBattlResults.SecondSongId     = Convert.ToInt32(reader["secondSongId"].ToString());
                        viewBattlResults.ArtistNameSecond = reader["artistNameSecond"].ToString();
                        viewBattlResults.ArtistNameFirst  = reader["artistNameFirst"].ToString();
                        viewBattlResults.TotalSecond      = Convert.ToInt32(reader["totalSecond"].ToString());
                        viewBattlResults.TotalFirst       = Convert.ToInt32(reader["totalFirst"].ToString());
                        viewBattlResults.ProfileId        = Convert.ToInt32(reader["profileId"].ToString());
                        viewBattlResults.Active           = Convert.ToBoolean(reader["active"].ToString());
                        _collection.Add(viewBattlResults);
                    }
                }
            }

            return(_collection);
        }