示例#1
0
        public void ModifySupplier(long cid, string fname, string lname, string telephone)
        {
            using (var context = new ContactContext())
            {
                var supplier = context.Suppliers.Find(cid);

                if (supplier == null)
                {
                    throw new ApplicationException($"Could not find the cutomer with Supplier Id: {cid}");
                }

                supplier.FirstName = fname;
                supplier.LastName  = lname;
                supplier.Telephone = telephone;
                context.SaveChanges();
            }
        }
示例#2
0
        public void ModifyCusotmer(long cid, string fname, string lname, DateTime?dt, string email)
        {
            using (var context = new ContactContext())
            {
                var customer = context.Customers.Find(cid);

                if (customer == null)
                {
                    throw new ApplicationException($"Could not find the cutomer with Customer Id: {cid}");
                }

                customer.FirstName = fname;
                customer.LastName  = lname;
                customer.BirthDay  = dt;
                customer.Email     = email;
                context.SaveChanges();
            }
        }