public ActionResult Edit(Contact contact) { if (ModelState.IsValid) { db.Contacts.Attach(contact); db.ObjectStateManager.ChangeObjectState(contact, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(contact); }
public ActionResult Create(Contact contact) { if (ModelState.IsValid) { db.Contacts.AddObject(contact); db.SaveChanges(); return RedirectToAction("Index"); } return View(contact); }
/// <summary> /// Deprecated Method for adding a new object to the Contacts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToContacts(Contact contact) { base.AddObject("Contacts", contact); }
/// <summary> /// Create a new Contact object. /// </summary> /// <param name="firstName">Initial value of the FirstName property.</param> /// <param name="lastName">Initial value of the LastName property.</param> /// <param name="passwordHash">Initial value of the PasswordHash property.</param> /// <param name="passwordSalt">Initial value of the PasswordSalt property.</param> /// <param name="contactID">Initial value of the ContactID property.</param> /// <param name="gender">Initial value of the Gender property.</param> public static Contact CreateContact(global::System.String firstName, global::System.String lastName, global::System.String passwordHash, global::System.String passwordSalt, global::System.Int32 contactID, global::System.String gender) { Contact contact = new Contact(); contact.FirstName = firstName; contact.LastName = lastName; contact.PasswordHash = passwordHash; contact.PasswordSalt = passwordSalt; contact.ContactID = contactID; contact.Gender = gender; return contact; }