Esempio n. 1
0
        /// <summary>
        /// Create a new List with new instances of Parcels.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="startId"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static List <Entity.Parcel> CreateParcels(this PimsContext context, int startId, int count)
        {
            var agency = context.Agencies.FirstOrDefault(a => a.Id == 1) ?? EntityHelper.CreateAgency(startId);

            var parcels = new List <Entity.Parcel>(count);

            for (var i = startId; i < (startId + count); i++)
            {
                parcels.Add(context.CreateParcel(i, 0, 0, agency));
            }
            return(parcels);
        }
Esempio n. 2
0
 /// <summary>
 /// Create a new instance of a Parcel.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="pid"></param>
 /// <param name="agency"></param>
 /// <returns></returns>
 public static Entity.Parcel CreateParcel(this PimsContext context, int pid, Entity.Agency agency)
 {
     return(context.CreateParcel(pid, 0, 0, agency));
 }