Пример #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);
        }
 partial void DeleteBusinessEntity(BusinessEntity instance);
 partial void UpdateBusinessEntity(BusinessEntity instance);
 partial void InsertBusinessEntity(BusinessEntity instance);
 partial void DeleteBusinessEntity(BusinessEntity instance);
 partial void UpdateBusinessEntity(BusinessEntity instance);
 partial void InsertBusinessEntity(BusinessEntity instance);