public ActionResult Create(ItemType itemtype) { if (ModelState.IsValid) { db.ItemTypes.AddObject(itemtype); db.SaveChanges(); return RedirectToAction("Index"); } return View(itemtype); }
/// <summary> /// Create a new ItemType object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="description">Initial value of the Description property.</param> public static ItemType CreateItemType(global::System.Int32 id, global::System.String description) { ItemType itemType = new ItemType(); itemType.Id = id; itemType.Description = description; return itemType; }
/// <summary> /// Deprecated Method for adding a new object to the ItemTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToItemTypes(ItemType itemType) { base.AddObject("ItemTypes", itemType); }
public ActionResult Edit(ItemType itemtype) { if (ModelState.IsValid) { db.ItemTypes.Attach(itemtype); db.ObjectStateManager.ChangeObjectState(itemtype, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(itemtype); }