Ejemplo n.º 1
0
        public BreedDAL BreedFindbyID(int BreedID)
        {
            BreedDAL proposedReturnValue = null;

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("BreedFindByID", sec))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@BreedID", BreedID);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        BreedMapper bm = new BreedMapper(reader);
                        while (reader.Read())
                        {
                            proposedReturnValue = bm.ToBreed(reader);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Logger.Log(ex);
            }
            return(proposedReturnValue);
        }
Ejemplo n.º 2
0
        public List <BreedDAL> BreedGetAll(int Skip, int Take)
        {
            List <BreedDAL> proposedReturnValue = new List <BreedDAL>();

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("BreedGetAll", sec))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@skip", Skip);
                    command.Parameters.AddWithValue("@take", Take);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        BreedMapper bm = new BreedMapper(reader);
                        while (reader.Read())
                        {
                            BreedDAL items = bm.ToBreed(reader);
                            proposedReturnValue.Add(items);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Logger.Log(ex);
            }
            return(proposedReturnValue);
        }