public IEnumerable <MamaDogQuery> GetAll()
        {
            using (SqlConnection conn = new SqlConnection())
            {
                List <MamaDogQuery> mamas = new List <MamaDogQuery>();
                conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetAllMamaDogs";

                conn.Open();
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        MamaDogQuery current = new MamaDogQuery();

                        current.MamaDogId   = (int)dr["MamaDogId"];
                        current.Name        = dr["Name"].ToString();
                        current.Breed       = dr["Breed"].ToString();
                        current.PuppyCount  = string.IsNullOrEmpty(dr["PuppyCount"].ToString()) ? 0: (int)dr["PuppyCount"];
                        current.LitterCount = string.IsNullOrEmpty(dr["LitterCount"].ToString()) ? 0: (int)dr["LitterCount"];
                        current.BirthDate   = (DateTime)dr["BirthDate"];

                        current.BirthDate.ToShortDateString();

                        mamas.Add(current);
                    }
                }
                return(mamas);
            }
        }
        public MamaDogQuery GetById(int id)
        {
            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetMamaDogById";
                cmd.Parameters.AddWithValue("@MamaDogId", id);

                conn.Open();
                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        MamaDogQuery current = new MamaDogQuery();

                        current.MamaDogId   = (int)dr["MamaDogId"];
                        current.Name        = dr["Name"].ToString();
                        current.Breed       = dr["Breed"].ToString();
                        current.PuppyCount  = string.IsNullOrEmpty(dr["PuppyCount"].ToString()) ? 0 : (int)dr["PuppyCount"];
                        current.LitterCount = string.IsNullOrEmpty(dr["LitterCount"].ToString()) ? 0 : (int)dr["LitterCount"];
                        current.BirthDate   = (DateTime)dr["BirthDate"];

                        return(current);
                    }
                }
            }
            return(null);
        }