Exemple #1
0
        public IEnumerable <ParticularNewsIntoBoardEntity> GetNews()
        {
            var result = new List <ParticularNewsIntoBoardEntity>();

            using (var dbCommand = Database.GetStoredProcCommand("dbo.[spGetBoardNews]"))
            {
                using (var reader = Database.ExecuteReader(dbCommand))
                {
                    if (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }

                    while (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }
                }
            }
            return(result);
        }
        public IEnumerable <AnimalKindEntity> GetAnimalTypes()
        {
            var result = new List <AnimalKindEntity>();

            using (var dbCommand = Database.GetStoredProcCommand("dbo.[spGetAnimalTypes]"))
            {
                using (var reader = Database.ExecuteReader(dbCommand))
                {
                    if (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }

                    while (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }
                }
            }
            return(result);
        }
        public AnimalKindEntity GetById(int id)
        {
            var result = new List <AnimalKindEntity>();

            using (var dbCommand = Database.GetStoredProcCommand("dbo.[spGetAnimalTypesById]"))
            {
                Database.AddInParameter(dbCommand, "@Id", DbType.Int32, id);
                using (var reader = Database.ExecuteReader(dbCommand))
                {
                    if (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }

                    while (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }
                }
            }
            return(result.FirstOrDefault());
        }
        public IEnumerable <AnimalParticularEntity> GetAnimalsbyAnimalKindId(int animalKindId)
        {
            var result = new List <AnimalParticularEntity>();

            using (var dbCommand = Database.GetStoredProcCommand("dbo.spGetAnimalsbyAnimalKindId"))
            {
                Database.AddInParameter(dbCommand, "@AnimalKindId", DbType.Int32, animalKindId);
                using (var reader = Database.ExecuteReader(dbCommand))
                {
                    if (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }

                    while (reader.Read())
                    {
                        result.Add(RowMapper.MapRow(reader));
                    }
                }
            }

            return(result);
        }