Ejemplo n.º 1
0
        public virtual async Task <SalutationCollection> Get()
        {
            var salutations = new List <Salutation>()
            {
                new Salutation("Mr", "Mr"),
                new Salutation("Mrs", "Mrs"),
                new Salutation("Ms", "Ms"),
                new Salutation("Mx", "Mx"),
            };

            var collection = new SalutationCollection(salutations);

            return(await Task.FromResult(collection));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads a collection of Salutation objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the Salutation objects in the database.</returns>
        public static SalutationCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            SalutationCollection result = new SalutationCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    Salutation tmp = new Salutation();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }