Ejemplo n.º 1
0
        public Shipper Get(int id)
        {
            Shipper             s          = new Shipper();
            List <SqlParameter> parameters = new List <SqlParameter>
            {
                new SqlParameter("@id", id)
            };
            SqlDataReader reader = helper.GetData("Select * from Shippers where ShipperID=@id", CommandType.Text, parameters);

            while (reader.Read())
            {
                s.CompanyName = reader["CompanyName"].ToString();
                s.Phone       = reader["Phone"].ToString();
                s.ShipperID   = Convert.ToInt32(reader["ShipperID"]);
            }
            return(s);
        }
Ejemplo n.º 2
0
        public Category Get(int id)
        {
            Category            s          = new Category();
            List <SqlParameter> parameters = new List <SqlParameter>
            {
                new SqlParameter("@id", id)
            };
            SqlDataReader reader = helper.GetData("Select * from Categories where CategoryID=@id", CommandType.Text, parameters);

            while (reader.Read())
            {
                s.CategoryName = reader[nameof(s.CategoryName)].ToString();
                s.Description  = reader[nameof(s.Description)].ToString();
                s.Picture      = reader[nameof(s.Picture)].ToString();
                s.CategoryID   = Convert.ToInt32(reader[nameof(s.CategoryID)]);
            }
            return(s);
        }
        public ApplicationUser Get(int id)
        {
            ApplicationUser     user       = new ApplicationUser();
            string              cmdText    = "Select * from ApplicationUser where Id=@id";
            List <SqlParameter> parameters = new List <SqlParameter>
            {
                new SqlParameter("@id", id)
            };

            var reader = helper.GetData(cmdText, CommandType.Text, parameters);

            while (reader.Read())
            {
                user.FullName = reader[nameof(user.FullName)].ToString();
                user.UserName = reader[nameof(user.UserName)].ToString();
                user.Password = reader[nameof(user.Password)].ToString();
                user.Email    = reader[nameof(user.Email)].ToString();
                user.Id       = Convert.ToInt32(reader[nameof(user.Id)]);
            }

            return(user);
        }