예제 #1
0
        public void Create(Supplier supplier)
        {
            var sqlSupplier = SqlSupplier.FromSupplier(supplier);

            context.Suppliers.Add(sqlSupplier);
            context.SaveChanges();
        }
예제 #2
0
        public void Update(Supplier supplier)
        {
            var sqlSupplier = SqlSupplier.FromSupplier(supplier);

            context.SetModified(sqlSupplier);
            context.SaveChanges();
        }
예제 #3
0
        /// <summary>Converts a domain model object to a form that is suitable for storing in a relational database.</summary>
        public static SqlSupplierGroup FromSupplierGroup(SupplierGroup group)
        {
            if (group == null)
            {
                throw new ArgumentNullException("Supplier group can't be null.");
            }

            return(new SqlSupplierGroup
            {
                Id = group.Id,
                Name = group.Name,
                Suppliers = group.Suppliers.Select(s => SqlSupplier.FromSupplier(s)).ToList()
            });
        }