public ActionResult Create([Bind(Include = "CustomerID,NameStyle,Title,FirstName,MiddleName,LastName,Suffix,CompanyName,SalesPerson,EmailAddress,Phone,PasswordHash,PasswordSalt,rowguid,ModifiedDate,IsDeleted")] Customer customer) { if (ModelState.IsValid) { db.Customer.Add(customer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Create([Bind(Include = "AddressID,AddressLine1,AddressLine2,City,StateProvince,CountryRegion,PostalCode,rowguid,ModifiedDate")] Address address) { if (ModelState.IsValid) { db.Address.Add(address); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(address)); }
public ActionResult Create([Bind(Include = "CustomerID,AddressID,AddressType,rowguid,ModifiedDate")] CustomerAddress customeraddress) { if (ModelState.IsValid) { db.CustomerAddress.Add(customeraddress); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AddressID = new SelectList(db.Address, "AddressID", "AddressLine1", customeraddress.AddressID); ViewBag.CustomerID = new SelectList(db.Customer, "CustomerID", "Title", customeraddress.CustomerID); return(View(customeraddress)); }