本文整理汇总了C#中PageModel.Create方法的典型用法代码示例。如果您正苦于以下问题:C# PageModel.Create方法的具体用法?C# PageModel.Create怎么用?C# PageModel.Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel.Create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create_Should_Validate_Title
public void Create_Should_Validate_Title()
{
dynamic data = new ExpandoObject();
data.Id = "id";
data.Title = null; // <-- it should catch this
var repository = new Mock();
var model = new PageModel();
model.Repository = repository;
model.Create(data);
Assert.IsTrue(model.HasError);
}
示例2: Create_Should_Validate_New_Title_Exists
public void Create_Should_Validate_New_Title_Exists()
{
dynamic data = new ExpandoObject();
data.Id = null;
data.Title = "new title";
var repository = new Mock();
repository.Setup("Exists", new object[] { "new title" }, true); // <-- it should catch this
var model = new PageModel();
model.Repository = repository;
model.Create(data);
Assert.IsTrue(model.HasError);
repository.Verify();
}
示例3: btnFinish_Click
protected void btnFinish_Click(object sender, EventArgs e)
{
string title = (pageBuilderWizardPageTitle.Text).Trim();
string aliasName = String.Empty;
string extension = String.Empty;
long pageId = 0;
int languageId = 1033;
long folderId = -1;
long wireFrameId = 0;
// prep some variables for later use
PageModel pageModel = new PageModel();
PageData pageInfo = new PageData();
WireframeModel model = new WireframeModel();
WireframeData wireframeInfo = new WireframeData();
if (ManualAliasing.GetActiveView() == ManualAliasingEnabled && pageBuilderCreateManualAlias.Checked)
{
// if url aliasing is enabled, pre-pop using urlAlias field
aliasName = (pageBuilderWizardAlias.Text).Trim();
extension = ExtensionDropdown.SelectedValue;
if (extension != "none")
{
if (!aliasName.EndsWith(extension, true, null))
{
aliasName += extension;
}
}
}
if (Request.QueryString["mode"] != "" && Request.QueryString["mode"] != null)
{
mode = Request.QueryString["mode"];
}
if (Request.QueryString["pageid"] != "" && Request.QueryString["pageid"] != null)
{
pageId = Convert.ToInt64(Request.QueryString["pageid"]);
}
if (Request.Form["ektronSelectedTemplate"] != "" && Request.Form["ektronSelectedTemplate"] != null)
{
wireFrameId = Convert.ToInt64(Request.Form["ektronSelectedTemplate"]);
}
string summary = Summary.Content;
if (Request.QueryString["folderid"] != "" && Request.QueryString["folderid"] != null)
{
folderId = Convert.ToInt64(Request.QueryString["folderid"]);
}
if (Request.QueryString["language"] != "" && Request.QueryString["language"] != null)
{
languageId = Convert.ToInt32(Request.QueryString["language"]);
}
if (languageId == -1)
{
languageId = contentAPI.RequestInformationRef.ContentLanguage;
}
System.Collections.Hashtable meta = metadata.Metadata;
List<long> selTaxonomy = selectTaxonomy.SelectedTaxonomies;
string metaXML = "";
string Quicklink = "";
//<metadata><meta id="3">Title</meta></metadata>
foreach (object key in meta.Keys)
{
metaXML += @"<meta id=""" + ((object[])meta[key])[0] + @""">" + EkFunctions.HtmlEncode(((object[])meta[key])[2].ToString()) + "</meta>";
}
metaXML = "<metadata>" + metaXML + "</metadata>";
// create or copy as needed
if (mode == "add")
{
// no pageId was passed, so we're in add mode
// create the wireframe
pageModel.Create(title, folderId, aliasName, languageId, wireFrameId, metaXML, summary, out pageInfo);
}
else
{
// we're in copy mode
// let's get the wireframeId based on the current template
pageModel.Get(pageId, out pageInfo, false);
wireframeInfo = model.FindByPageID(pageInfo.pageID);
wireFrameId = wireframeInfo.ID;
pageInfo.title = title;
// now we'll make the copy
pageModel.Copy(pageInfo, folderId, aliasName, languageId, wireFrameId, metaXML, summary, out pageInfo);
}
if (selTaxonomy.Count > 0)
{
TaxonomyContentRequest tcr = new TaxonomyContentRequest();
tcr.ContentId = pageInfo.pageID;
tcr.TaxonomyList = String.Join(",", selTaxonomy.ConvertAll<string>(delegate(long l) { return l.ToString(); }).ToArray());
contentAPI.AddTaxonomyItem(tcr);
}
//.........这里部分代码省略.........