コード例 #1
0
        public ActionResult Create([Bind(Include = "FirstName,LastName,Title")] Person person)
        {
            if (ModelState.IsValid)
            {
                using (var pp = new AdventureWorksDataContext())
                {
                    person.ModifiedDate = DateTime.Now;
                    person.PersonType = "EM";
                    person.BusinessEntityID = 1;

                    var businessEntity = new BusinessEntity();
                    businessEntity.ModifiedDate = DateTime.Now;
                    businessEntity.Person = person;
                    businessEntity.rowguid = Guid.NewGuid( );

                    person.BusinessEntity = businessEntity;

                    pp.BusinessEntities.InsertOnSubmit(businessEntity);
                    pp.Persons.InsertOnSubmit(person);
                    pp.SubmitChanges();
                }

                return RedirectToAction("Index");
            }

            return View(person);
        }
コード例 #2
0
 partial void DeleteBusinessEntity(BusinessEntity instance);
コード例 #3
0
 partial void UpdateBusinessEntity(BusinessEntity instance);
コード例 #4
0
 partial void InsertBusinessEntity(BusinessEntity instance);
コード例 #5
0
 partial void DeleteBusinessEntity(BusinessEntity instance);
コード例 #6
0
 partial void UpdateBusinessEntity(BusinessEntity instance);
コード例 #7
0
 partial void InsertBusinessEntity(BusinessEntity instance);