本文整理汇总了C#中Story.IsSavable方法的典型用法代码示例。如果您正苦于以下问题:C# Story.IsSavable方法的具体用法?C# Story.IsSavable怎么用?C# Story.IsSavable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Story
的用法示例。
在下文中一共展示了Story.IsSavable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add_Story
protected void Add_Story()
{
//make a new story object
Story story = new Story();
//set story's Title property to value from txtTitle
story.Title = this.txtTitle.Value;
//set story's Summary property to value from txtSummary
story.Summary = this.txtSummary.Value;
//set story's FandomID property to selected value of ddlFandom
story.FandomID = new Guid(this.ddlFandom.SelectedValue);
//set story's GenreID1 property to selected value of ddlGenre1
story.GenreID1 = new Guid(this.ddlGenre1.SelectedValue);
//set story's GenreID2 property to selected value of ddlGenre2
story.GenreID2 = new Guid(this.ddlGenre2.SelectedValue);
//set story's MaturityID property to selected value of ddlMaturityID
story.MaturityID = new Guid(this.ddlMaturity.SelectedValue);
//set stryUser UserID to the User's ID (stored in session)
usersStories.UserID = userID;
//if statement will run if story.IsSavable equals true
if (story.IsSavable() == true)
{
//if the story is savable, save it
story = story.Save();
//set the storyID of stryUsers to the id of story
usersStories.StoryID = story.Id;
//make a new User called usr
User usr = new User();
//get the right user by userID (taken from Session["UserID"])
usr = usr.GetById(userID);
//set usr's StoryAmount property to equal itself plus 1
usr.StoryAmount = usr.StoryAmount + 1;
//set usersStories' UserId property to value of userID
usersStories.UserID = userID;
//call save_Bridges
save_Bridges();
//redirect user to AddChapter page
Server.Transfer("AddChapter.aspx", true);
}
}