示例#1
0
        public IHttpActionResult updatePost(PostBindingModel aPost)
        {
            if (!ModelState.IsValid) return BadRequest(ModelState);
 //           ApplicationDbContext db = new ApplicationDbContext();

            return Ok();
        }
示例#2
0
        public IHttpActionResult newPost(PostBindingModel newPost)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            var tempPost = new Models.Posts()
            {
                AspNetUser = PostsLogic.postContext.AspNetUsers.First(u => u.Id == User.Identity.GetUserId()),
                Content = newPost.Content,
               // PostDate = DateTime.Now,
                JsonPicture = newPost.JsonPicture
            };

            PostsLogic.postContext.Posts.InsertOnSubmit(tempPost);
            PostsLogic.postContext.SubmitChanges();

            return Ok();
        }