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 UpdatePlannedInTrello() { var postsToAdd = _planningSpreadsheetService.GetPosts().Where(bp => ShouldBeAddedToTrello(bp)); foreach (var post in postsToAdd) { _trelloService.AddCard(post); } }