/// <summary> /// Create a new ShowItemsList 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="createMethod">Initial value of the CreateMethod property.</param> /// <param name="code">Initial value of the Code property.</param> /// <param name="createTime">Initial value of the CreateTime property.</param> public static ShowItemsList CreateShowItemsList(global::System.Int32 id, global::System.String name, global::System.String description, global::System.String createMethod, global::System.String code, global::System.DateTime createTime) { ShowItemsList showItemsList = new ShowItemsList(); showItemsList.Id = id; showItemsList.Name = name; showItemsList.Description = description; showItemsList.CreateMethod = createMethod; showItemsList.Code = code; showItemsList.CreateTime = createTime; return showItemsList; }
/// <summary> /// Deprecated Method for adding a new object to the ShowItemsList EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToShowItemsList(ShowItemsList showItemsList) { base.AddObject("ShowItemsList", showItemsList); }
public ActionResult AddList(ShowItemsList itemList) { itemList.CreateTime = DateTime.Now; DBContext.AddToShowItemsList(itemList); DBContext.SaveChanges(); if (Request.Form["resourceid"] != null) { string[] resources = Request.Form["resourceid"].TrimEnd(',').Split(','); var delList = DBContext.ListResources.Where(e => e.ListID == itemList.Id).ToList(); foreach (var v in delList) { DBContext.ListResources.DeleteObject(v); } for (int i = 0; i < resources.Length; i++) { if (resources[i] != string.Empty) { ListResources ir = new ListResources { ListID = itemList.Id, ResourceID = int.Parse(resources[i]) }; DBContext.AddToListResources(ir); } } DBContext.SaveChanges(); } return RedirectToAction("IndexList"); }