public Guid Create(BlogPost blogPost) { blogPost.UniqueId = Guid.NewGuid(); blogPost.CreateDate = blogPost.ModifiedDate = DateTime.Now.ToJavaScriptMilliseconds(); BlogPosts.Add(blogPost); return blogPost.UniqueId; }
public void Update(Guid uniqueId, BlogPost blogPost) { var blogPostToUpdate = BlogPosts.FirstOrDefault(i => i.UniqueId == uniqueId); if (blogPostToUpdate == null) return; blogPostToUpdate.Title = blogPost.Title ?? blogPostToUpdate.Title; blogPostToUpdate.Description = blogPost.Description ?? blogPostToUpdate.Description; blogPostToUpdate.Body = blogPost.Body ?? blogPostToUpdate.Body; blogPostToUpdate.PublishedDate = blogPost.PublishedDate; blogPostToUpdate.Slug = blogPost.Slug ?? blogPostToUpdate.Slug; blogPostToUpdate.Tags = blogPost.Tags ?? blogPostToUpdate.Tags; blogPostToUpdate.ModifiedDate = DateTime.Now.ToJavaScriptMilliseconds(); }
public JsonResult Post(string userName, PostDescriptorModel post) { var blogPost = new BlogPost { CreatedBy = userName, CreatedDate = DateTime.Now, Title = post.Title, Body = post.Body, Url = CreatePostUrl(post.Title) }; _context.BlogPosts.InsertOnSubmit(blogPost); _context.SubmitChanges(); return Json( new { success = true, url = blogPost.Url }); }
public void Put(Guid uniqueId, BlogPost value) { _blogPostsService.Update(uniqueId, value); }
public void Post(BlogPost value) { _blogPostsService.Create(value); }
partial void DeleteBlogPost(BlogPost instance);
partial void UpdateBlogPost(BlogPost instance);
partial void InsertBlogPost(BlogPost instance);