示例#1
0
        public ActionResult <Posts> Create(Posts post)
        {
            _databaseServices.CreatePost(post);

            return(CreatedAtRoute("GetUser", new { id = post.Id.ToString() }, post));
        }
        public object SeedingPosts()
        {
            var users   = _databaseServices.GetUsers();
            var circles = _databaseServices.GetCircles();

            Posts p1 = new Posts();

            p1.ispublic  = true;
            p1.Poster_Id = users[0].Id;
            p1.Image     = "";
            p1.text      = "Hej med dig din stej";
            p1.Circle_Id = circles[0].Id;

            Posts p2 = new Posts();

            p2.ispublic  = true;
            p2.Poster_Id = users[2].Id;
            p2.Image     = "";
            p2.text      = "Frands er høj";
            p2.Circle_Id = circles[2].Id;

            Posts p3 = new Posts();

            p3.ispublic  = true;
            p3.Poster_Id = users[1].Id;
            p3.Image     = "";
            p3.text      = "Hej med dig din stej";
            p3.Circle_Id = circles[1].Id;

            Posts p4 = new Posts();

            p4.ispublic  = true;
            p4.Poster_Id = users[0].Id;
            p4.Image     = "";
            p4.text      = "Hansen er ikke en del af MIB";
            p4.Circle_Id = circles[2].Id;

            Posts p5 = new Posts();

            p5.ispublic  = false;
            p5.Poster_Id = users[4].Id;
            p5.Image     = "";
            p5.text      = "Jeg vil gerne sige hej";
            p5.Circle_Id = null;

            Posts p6 = new Posts();

            p6.ispublic  = false;
            p6.Poster_Id = users[1].Id;
            p6.Image     = "";
            p6.text      = "nononoononoon!";
            p6.Circle_Id = circles[0].Id;

            Posts p7 = new Posts();

            p7.ispublic  = true;
            p7.Poster_Id = users[2].Id;
            p7.Image     = "";
            p7.text      = "My gun is golden";
            p7.Circle_Id = circles[1].Id;

            _databaseServices.CreatePost(p1);
            _databaseServices.CreatePost(p2);
            _databaseServices.CreatePost(p3);
            _databaseServices.CreatePost(p4);
            _databaseServices.CreatePost(p5);
            _databaseServices.CreatePost(p6);
            _databaseServices.CreatePost(p7);

            return(CreatedAtRoute("GetUser", new { id = p1.Id.ToString() }, p1));
        }