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


C# Post类代码示例

本文整理汇总了C#中Post的典型用法代码示例。如果您正苦于以下问题:C# Post类的具体用法?C# Post怎么用?C# Post使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Post类属于命名空间,在下文中一共展示了Post类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteAPost

        public void DeleteAPost(int postID)
        {

            NewsfeedDAL newsfeedDAL = new NewsfeedDAL();
            Post aPost = new Post(postID);
            newsfeedDAL.FlagPost(aPost);
        }
开发者ID:Ndiya999,项目名称:Bulabula,代码行数:7,代码来源:postsWebservice.asmx.cs

示例2: ShouldMatch

 public static void ShouldMatch(this PostViewModel candidate, Post actual)
 {
     candidate.Author.ShouldEqual(actual.Author);
     candidate.Content.ShouldEqual(actual.Content);
     candidate.PublishDate.ShouldEqual(actual.PublishDate);
     candidate.Title.ShouldEqual(actual.Title);
 }
开发者ID:bmavity,项目名称:MaviBlog,代码行数:7,代码来源:SpecExtensions.cs

示例3: AddComment

        public string AddComment(int postID, string commentTxt)
        {
            Comments comment = new Comments();
            comment.MemberId = Context.Session["memberID"].ToString();
            comment.CommentText = commentTxt;
            comment.PostId = postID;
            messageDAL.InsertComment(comment);

            //Insert notification
            NotificationDAL notificationDAL = new NotificationDAL();

            Post aPost = new Post(postID);

            List<Member> MemberList = new List<Member>();
            MemberList = notificationDAL.GetPostOwner(aPost);
            string friendId = MemberList[0].MemberId;
            Member aFriend = new Member(friendId);

            Member aMember = new Member(Context.Session["memberID"].ToString());

            if (aMember.MemberId != aFriend.MemberId)
            {
                notificationDAL.InsertCommentedOnPostNotification(aMember, aFriend, aPost);
            }
            //Refreshing the Comment count
            Post post = new Post();
            post.PostId = comment.PostId;

            return messageDAL.CountComments(post).ToString();
        }
开发者ID:Ndiya999,项目名称:Bulabula,代码行数:30,代码来源:processComments.asmx.cs

示例4: get_column_value

 public void get_column_value()
 {
     var post = new Post() {Title = "title12"};
     var id = _db.Insert(post).InsertedId<int>();
     Assert.Equal("title12",_db.GetColumnValue<Post,string>(p=>p.Title,p => p.Id == id));
     Assert.Null(_db.GetColumnValue<Post, string>(p => p.Title, p => p.Id == 2890));
 }
开发者ID:wolfascu,项目名称:SqlFu,代码行数:7,代码来源:DbExtrensionsMethodsTests.cs

示例5: Create

        public ActionResult Create(FormCollection formCollection)
        {
            string title = formCollection.Get("Title");
            string body = formCollection.Get("Body");
            bool isPublic = formCollection.Get("IsPublic").Contains("true");

            IRepository<Category> categoriesRepo = new CategoryRepository();
            IRepository<Post> postsRepo = new PostRepository();
            List<Category> allCategories = (List<Category>)categoriesRepo.GetAll();

            Post post = new Post();
            post.Body = body;
            post.Title = title;
            post.CreationDate = DateTime.Now;
            post.IsPublic = isPublic;

            foreach (Category category in allCategories)
            {
                if (formCollection.Get(category.Id.ToString()).Contains("true"))
                    post.Categories.Add(category);

            }

            postsRepo.Save(post);


            return RedirectToAction("Index");
        }
开发者ID:Soucre,项目名称:Working_git_vfs,代码行数:28,代码来源:PostsController.cs

示例6: FindByLegend

 //
 public ActionResult FindByLegend(Post post)
 {
     PostServiceClient service = new PostServiceClient();
     //Davi ira fazer o metodo
     //service.findByLegend(post);
     return PartialView("_FindPost");
 }
开发者ID:quirino,项目名称:dedurando-web,代码行数:8,代码来源:PostController.cs

示例7: Main

        static void Main(string[] args)
        {
            Client client = new Client("2", "a18632aa82be8e925ef349164314311a", "http://hook.dev/public/index.php/");
            Collection posts = client.Collection ("posts");

            var post = new Post ();
            post.title = "Hello there!";
            post.score = 15;
            post.date = new DateTime (2014, 07, 07, 17, 30, 0);

            posts.Create (post).ContinueWith<Post> (result => {
                Console.WriteLine(result.ToString());
            });

            posts.Get ().ContinueWith<Post[]> (result => {
                Console.WriteLine(result.ToString());
            });

            req = posts.Sort ("created_at", Order.DESCENDING).Limit(1).First().ContinueWith<Post> (data => {
                Console.WriteLine("Post id: ");
                Console.WriteLine(data._id);
            });

            NSApplication.Init ();
            NSApplication.Main (args);
        }
开发者ID:endel,项目名称:hook-csharp,代码行数:26,代码来源:Main.cs

示例8: Database

 public ActionResult Database()
 {
     posts.DeleteAll();
     var folders = Directory.GetDirectories(Server.MapPath("~" + Constants.PostsFolder));
     var messagesAndErrors = new List<Pair<string, bool>>();
     foreach (var folder in folders)
     {
         var entry = new Post();
         var dir = new DirectoryInfo(folder);
         var postMessagesAndErrors = populators.Select(x =>
                                              {
                                                  try
                                                  {
                                                      x.Populate(entry, dir);
                                                      return new Pair<string, bool>(string.Format("{0} | {1} is OK.", entry.Slug, x.GetType().Name), true);
                                                  }
                                                  catch (Exception e)
                                                  {
                                                      return new Pair<string, bool>(string.Format("{0} | {1} | {2}", entry.Slug, e.GetType(), e.Message), false);
                                                  }
                                              }).ToList();
         messagesAndErrors.AddRange(postMessagesAndErrors);
         if (postMessagesAndErrors.All(x => x.Other)) posts.Save(entry);
         posts.Commit();
     }
     return View(messagesAndErrors);
 }
开发者ID:chandru9279,项目名称:zasz.me,代码行数:27,代码来源:SyncController.cs

示例9: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Permission.Check("post.read", true)) return;

        if (!Page.IsPostBack)
        {
            using (MooDB db = new MooDB())
            {
                if (Request["id"] != null)
                {
                    int postID = int.Parse(Request["id"]);
                    post = (from p in db.Posts
                            where p.ID == postID
                            select p).SingleOrDefault<Post>();
                }

                if (post == null)
                {
                    PageUtil.Redirect(Resources.Moo.FoundNothing, "~/");
                    return;
                }

                ViewState["postID"] = post.ID;
                Page.DataBind();
            }
        }
    }
开发者ID:MooDevTeam,项目名称:MooOJ,代码行数:27,代码来源:Modify.aspx.cs

示例10: setup_sample_post

        private void setup_sample_post(User user)
        {
            var oxiteTag = new Tag {Name = "Oxite", CreatedDate = DateTime.Parse("12 NOV 2008")};

            var defaultPost = new Post
            {
                Title = "World.Hello()",
                Slug = "World_Hello",
                BodyShort = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Body = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Published = DateTime.Parse("2008-12-05 09:29:03.270"),
                User = user
            };
            defaultPost.AddTag(oxiteTag);

            _repository.Save(defaultPost);

            var defaultPost1 = new Post
            {
                Title = "World.Hello()",
                Slug = "World_Hello2",
                BodyShort = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Body = "Welcome to Oxite! &nbsp;This is a sample application targeting developers built on <a href=\"http://asp.net/mvc\">ASP.NET MVC</a>. &nbsp;Make any changes you like. &nbsp;If you build a feature you think other developers would be interested in and would like to share your code go to the <a href=\"http://www.codeplex.com/oxite\">Oxite Code Plex project</a> to see how you can contribute.<br /><br />To get started, sign in with \"Admin\" and \"pa$$w0rd\" and click on the Admin tab.<br /><br />For more information about <a href=\"http://oxite.net\">Oxite</a> visit the default <a href=\"/About\">About</a> page.",
                Published = DateTime.Parse("2008-12-05 09:29:03.270"),
                User = user
            };
            defaultPost1.AddTag(oxiteTag);
            defaultPost1.AddTag(new Tag { Name = "AltOxite", CreatedDate = DateTime.Parse("30 DEC 2008") });
            defaultPost1.AddComment(new Comment { Post = defaultPost1, User = user, Body = "test comment", Published = DateTime.Parse("31 DEC 2008") });

            _repository.Save(defaultPost1);
        }
开发者ID:Anupam-,项目名称:fubumvc-contrib,代码行数:32,代码来源:DefaultApplicationFirstRunHandler.cs

示例11: SetUp

        public void SetUp()
        {
            _siteConfiguration = new SiteConfiguration
            {
                TwitterUserName = "TestUser",
                TwitterPassword = "TestPassword",
            };

            _twitterClient = MockRepository.GenerateStub<ITwitterClient>();
            _tinyUrlService = MockRepository.GenerateStub<ITinyUrlService>();
            _urlResolver = MockRepository.GenerateStub<IUrlResolver>();

            _twitterService = new TwitterService(_siteConfiguration, _twitterClient, _tinyUrlService, _urlResolver);

            _user = new User
            {
                TwitterUserName = "MarkNijhof",
            };

            _post = new Post
            {
                User = _user,
                Title = "Test title",
            };
        }
开发者ID:Anupam-,项目名称:fubumvc-contrib,代码行数:25,代码来源:TwitterServiceTester.cs

示例12: Main

        static void Main(string[] args)
        {
            var post = new Post();

            post["title"] = "MyPost";
            post["description"] = "This is a description of my post";
            Console.WriteLine(post["title"]);
            Console.WriteLine(post["description"]);
            Console.WriteLine("This post was created: " + post.TimeCreated());

            for (var i = 0; i < 5; i++)
            {
                Console.WriteLine("\n\nTo UpVote this post, press 1.");
                Console.WriteLine("To DownVote this post, press  2.");
                if (Console.ReadLine() == "1")
                {
                    post.UpVote++;
                }
                else if (Console.ReadLine() == "2")
                {
                    post.DownVote++;
                }
                Console.WriteLine("\nThere are currently " + post.UpVote + " UpVotes " + "And " + post.DownVote + " Down Votes");
            }
        }
开发者ID:vegasbilly,项目名称:Exercise-2-StackOverflowPost,代码行数:25,代码来源:Program.cs

示例13: Save

    private static void Save(HttpContext context, Post post)
    {
        string name = context.Request.Form["name"];
        string email = context.Request.Form["email"];
        string website = context.Request.Form["website"];
        string content = context.Request.Form["content"];

        Validate(name, email, content);

        Comment comment = new Comment()
        {
            Author = name.Trim(),
            Email = email.Trim(),
            Website = GetUrl(website),
            Ip = context.Request.UserHostAddress,
            UserAgent = context.Request.UserAgent,
            IsAdmin = context.User.Identity.IsAuthenticated,
            Content = HttpUtility.HtmlEncode(content.Trim()).Replace("\n", "<br />"),
        };

        post.Comments.Add(comment);
        Storage.Save(post);

        if (!context.User.Identity.IsAuthenticated)
            System.Threading.ThreadPool.QueueUserWorkItem((s) => SendEmail(comment, post, context.Request));

        RenderComment(context, comment);
    }
开发者ID:EduOrtega,项目名称:build2014-MAML-EnablingSaaS,代码行数:28,代码来源:CommentHandler.cs

示例14: AnExceptionInvalidatesTheScopeAndPreventItsFlushing

        public void AnExceptionInvalidatesTheScopeAndPreventItsFlushing()
        {
            using (new SessionScope()) {
                Post.DeleteAll();
                Blog.DeleteAll();
            }

            Post post;

            // Prepare
            using(new SessionScope())
            {
                var blog = new Blog {Author = "hammett", Name = "some name"};
                blog.Save();

                post = new Post(blog, "title", "contents", "castle");
                post.Save();
            }

            using(var session = new SessionScope())
            {
                Assert.IsFalse(session.HasSessionError);

                Assert.Throws<ActiveRecordException>(() => {
                    post = new Post(new Blog(100), "title", "contents", "castle");
                    post.Save();
                    session.Flush();
                });

                Assert.IsTrue(session.HasSessionError);
            }
        }
开发者ID:shosca,项目名称:ActiveRecord,代码行数:32,代码来源:SessionScopeTestCase.cs

示例15: FindById

        public ActionResult FindById(Post post)
        {
            PostServiceClient service = new PostServiceClient();

            service.find(post);
            return View();
        }
开发者ID:quirino,项目名称:dedurando-web,代码行数:7,代码来源:PostController.cs


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