public ActionResult Create(Venue venue) { if (ModelState.IsValid) { db.Venues.AddObject(venue); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", venue.CountryId); return View(venue); }
public ActionResult Edit(Venue venue) { if (ModelState.IsValid) { db.Venues.Attach(venue); db.ObjectStateManager.ChangeObjectState(venue, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", venue.CountryId); return View(venue); }
/// <summary> /// Create a new Venue object. /// </summary> /// <param name="venueId">Initial value of the VenueId property.</param> /// <param name="venueName">Initial value of the VenueName property.</param> /// <param name="countryId">Initial value of the CountryId property.</param> public static Venue CreateVenue(global::System.Int32 venueId, global::System.String venueName, global::System.Int32 countryId) { Venue venue = new Venue(); venue.VenueId = venueId; venue.VenueName = venueName; venue.CountryId = countryId; return venue; }
public JsonResult JsonCreate(Venue venue) { if (ModelState.IsValid) { if (ModelState.IsValid) { db.Venues.AddObject(venue); db.SaveChanges(); return Json(new { success = true, returnData = new { venueId = venue.VenueId, venueName = venue.VenueName } }); } } // If we got this far, something failed return Json(new { errors = GetErrorsFromModelState() }); }
/// <summary> /// Deprecated Method for adding a new object to the Venues EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToVenues(Venue venue) { base.AddObject("Venues", venue); }