Exemplo n.º 1
0
        public IEnumerable <GetSpecials> GetSpecials()
        {
            List <GetSpecials> specials = new List <GetSpecials>();

            using (var conn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("GetAllSpecials", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                conn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        GetSpecials hp = new GetSpecials();

                        hp.SpecialId          = int.Parse(dr["SpecialId"].ToString());
                        hp.SpecialTitle       = dr["SpecialTitle"].ToString();
                        hp.SpecialDescription = dr["SpecialDescription"].ToString();

                        specials.Add(hp);
                    }
                }
            }
            return(specials);
        }
Exemplo n.º 2
0
        public IEnumerable <GetSpecials> GetSpecials()
        {
            List <GetSpecials> specials = new List <GetSpecials>();
            GetSpecials        hp       = new GetSpecials();

            foreach (var spec in specials)
            {
                spec.SpecialId          = hp.SpecialId;
                spec.SpecialTitle       = hp.SpecialTitle;
                spec.SpecialDescription = hp.SpecialDescription;

                specials.Add(spec);
            }

            return(specials);
        }
Exemplo n.º 3
0
        public IEnumerable <GetSpecials> GetSpecials()
        {
            List <GetSpecials> specials = new List <GetSpecials>();

            using (_ctx)
            {
                var listOfSpecials = _ctx.GetAllSpecials();

                foreach (var s in listOfSpecials)
                {
                    GetSpecials hp = new GetSpecials();

                    hp.SpecialId          = s.SpecialId;
                    hp.SpecialTitle       = s.SpecialTitle;
                    hp.SpecialDescription = s.SpecialDescription;

                    specials.Add(hp);
                }
            }
            return(specials);
        }
Exemplo n.º 4
0
        public List <GetSpecials> GetAllSpecials()
        {
            List <GetSpecials> specials = new List <GetSpecials>();

            using (_ctx = new GuildCarsEntities())
            {
                var listOfSpecials = _ctx.GetAllSpecials();

                foreach (var s in listOfSpecials)
                {
                    GetSpecials hp = new GetSpecials();

                    hp.SpecialId          = s.SpecialId;
                    hp.SpecialTitle       = s.SpecialTitle;
                    hp.SpecialDescription = s.SpecialDescription;

                    specials.Add(hp);
                }
            }
            return(specials);

            //throw new NotImplementedException();
        }