/// <summary> /// Create a new ListResources object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="listID">Initial value of the ListID property.</param> /// <param name="resourceID">Initial value of the ResourceID property.</param> public static ListResources CreateListResources(global::System.Int32 id, global::System.Int32 listID, global::System.Int32 resourceID) { ListResources listResources = new ListResources(); listResources.Id = id; listResources.ListID = listID; listResources.ResourceID = resourceID; return listResources; }
/// <summary> /// Deprecated Method for adding a new object to the ListResources EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToListResources(ListResources listResources) { base.AddObject("ListResources", listResources); }
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"); }