public ActionResult Create(ContentKeyword contentkeyword) { if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, write)) return RedirectToAction("Index", "Home"); if (ModelState.IsValid) { contentkeyword.ContentKeywordID = Guid.NewGuid(); contentkeyword.CreatedBy = Guid.Parse(Session["userid"].ToString()); contentkeyword.CreatedOn = DateTime.Now; db.ContentKeywords.AddObject(contentkeyword); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ContentID = new SelectList(db.ContentItems.Where(c => c.IsDeleted == null || c.IsDeleted == false), "ID", "Title", contentkeyword.ContentID); ViewBag.KeywordID = new SelectList(db.Keywords.Where(k => k.IsDeleted == null || k.IsDeleted == false), "ID", "Keyword1", contentkeyword.KeywordID); ViewBag.CreatedBy = new SelectList(db.Users, "ID", "UserName", contentkeyword.CreatedBy); ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", contentkeyword.ModifiedBy); return View(contentkeyword); }
/// <summary> /// Deprecated Method for adding a new object to the ContentKeywords EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToContentKeywords(ContentKeyword contentKeyword) { base.AddObject("ContentKeywords", contentKeyword); }
/// <summary> /// Create a new ContentKeyword object. /// </summary> /// <param name="contentKeywordID">Initial value of the ContentKeywordID property.</param> /// <param name="contentID">Initial value of the ContentID property.</param> /// <param name="keywordID">Initial value of the KeywordID property.</param> public static ContentKeyword CreateContentKeyword(global::System.Guid contentKeywordID, global::System.Guid contentID, global::System.Guid keywordID) { ContentKeyword contentKeyword = new ContentKeyword(); contentKeyword.ContentKeywordID = contentKeywordID; contentKeyword.ContentID = contentID; contentKeyword.KeywordID = keywordID; return contentKeyword; }