public ActionResult Create(BlogPost post, string createNew = null) { #region Move to a service _blogContext.BlogPosts.Add(post); _blogContext.SaveChanges(); _blogContext.UpdateBlogPostDependencies(post); InitializeTrelloService(); _writingCalendarService.AddCard(post); post.CalculateAuthorPay(); SyncToWordpress(post); _blogContext.SaveChanges(); #endregion if (ModelState.IsValid) { return(RedirectToAppropriatePage(post, createNew)); } else { return(Create(post.BlogId)); } }
public void BeforeEachTest() { Context.Authors.Add(AuthorWithOnePost); Context.Authors.Add(AuthorWithOneRefresh); Context.Editors.Add(EditorWithOnePost); Post.Author = AuthorWithOnePost; Post.Editor = EditorWithOnePost; Post.CalculateAuthorPay(); Post.CalculateEditorPay(); Target = new ReportsController(Context); }