public ActionResult Create(Location location) { if (ModelState.IsValid) { db.Locations.AddObject(location); db.SaveChanges(); return RedirectToAction("Index"); } return View(location); }
public ActionResult Edit(Location location) { if (ModelState.IsValid) { db.Locations.Attach(location); db.ObjectStateManager.ChangeObjectState(location, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(location); }
/// <summary> /// Create a new Location object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the name property.</param> /// <param name="description">Initial value of the description property.</param> /// <param name="maxUsers">Initial value of the maxUsers property.</param> /// <param name="maxTransactions">Initial value of the maxTransactions property.</param> /// <param name="isPublic">Initial value of the isPublic property.</param> /// <param name="isEnabled">Initial value of the isEnabled property.</param> public static Location CreateLocation(global::System.Int32 id, global::System.String name, global::System.String description, global::System.Int32 maxUsers, global::System.Int32 maxTransactions, global::System.Boolean isPublic, global::System.Boolean isEnabled) { Location location = new Location(); location.id = id; location.name = name; location.description = description; location.maxUsers = maxUsers; location.maxTransactions = maxTransactions; location.isPublic = isPublic; location.isEnabled = isEnabled; return location; }
/// <summary> /// Deprecated Method for adding a new object to the Locations EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToLocations(Location location) { base.AddObject("Locations", location); }