当前位置: 首页>>代码示例>>C#>>正文


C# Story.IsSavable方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:bwaites,项目名称:fanatafics,代码行数:41,代码来源:NewStory.aspx.cs


注:本文中的Story.IsSavable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。