public ActionResult Create(Builder builder) { if (ModelState.IsValid) { builder.Id = Guid.NewGuid(); db.Builders.AddObject(builder); db.SaveChanges(); return RedirectToAction("Index"); } return View(builder); }
public ActionResult Edit(Builder builder) { if (ModelState.IsValid) { db.Builders.Attach(builder); db.ObjectStateManager.ChangeObjectState(builder, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(builder); }
/// <summary> /// Create a new Builder object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="cityId">Initial value of the CityId property.</param> /// <param name="urlId">Initial value of the UrlId property.</param> public static Builder CreateBuilder(global::System.Guid id, global::System.String name, global::System.Guid cityId, global::System.String urlId) { Builder builder = new Builder(); builder.Id = id; builder.Name = name; builder.CityId = cityId; builder.UrlId = urlId; return builder; }
/// <summary> /// Deprecated Method for adding a new object to the Builders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBuilders(Builder builder) { base.AddObject("Builders", builder); }