Skip to content

Commit

Permalink
Update IForumAdapter interface to be async #361
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffputz committed Feb 9, 2024
1 parent 9907309 commit 046742e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/PopForums.Mvc/Areas/Forums/Controllers/ForumController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task<ActionResult> Index(string urlName, int pageNumber = 1)
var adapter = new ForumAdapterFactory(forum);
if (adapter.IsAdapterEnabled)
{
adapter.ForumAdapter.AdaptForum(this, container);
await adapter.ForumAdapter.AdaptForum(this, container);
if (string.IsNullOrWhiteSpace(adapter.ForumAdapter.ViewName))
return View(adapter.ForumAdapter.Model);
return View(adapter.ForumAdapter.ViewName, adapter.ForumAdapter.Model);
Expand Down Expand Up @@ -191,7 +191,7 @@ public async Task<ActionResult> Topic(string id, int pageNumber = 1)
container.TopicState = topicState;
if (adapter.IsAdapterEnabled)
{
adapter.ForumAdapter.AdaptTopic(this, container);
await adapter.ForumAdapter.AdaptTopic(this, container);
if (string.IsNullOrWhiteSpace(adapter.ForumAdapter.ViewName))
return View(adapter.ForumAdapter.Model);
return View(adapter.ForumAdapter.ViewName, adapter.ForumAdapter.Model);
Expand Down Expand Up @@ -363,7 +363,7 @@ public async Task<ActionResult> PostLink(int id)
var adapter = new ForumAdapterFactory(forum);
if (adapter.IsAdapterEnabled)
{
var result = adapter.ForumAdapter.AdaptPostLink(this, post, topic, forum);
var result = await adapter.ForumAdapter.AdaptPostLink(this, post, topic, forum);
if (result != null)
return result;
}
Expand Down
6 changes: 3 additions & 3 deletions src/PopForums.Mvc/Areas/Forums/Services/IForumAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public interface IForumAdapter
/// </summary>
/// <param name="controller">Instance of the controller calling the adapter.</param>
/// <param name="forumTopicContainer">The composed ForumTopicContainer created by the Index method of the ForumController.</param>
void AdaptForum(Controller controller, ForumTopicContainer forumTopicContainer);
Task AdaptForum(Controller controller, ForumTopicContainer forumTopicContainer);

/// <summary>
/// This method allows you to change the view and model generated by the Topic method of the ForumController by setting
/// the properties on the adapter.
/// </summary>
/// <param name="controller">Instance of the controller calling the adapter.</param>
/// <param name="topicContainer">The composed TopicContainer created by the Topic method of the ForumController.</param>
void AdaptTopic(Controller controller, TopicContainer topicContainer);
Task AdaptTopic(Controller controller, TopicContainer topicContainer);

/// <summary>
/// This method allows you to override the behavior of the ForumController's PostLink
Expand All @@ -36,7 +36,7 @@ public interface IForumAdapter
/// <param name="topic">The topic associated with the post.</param>
/// <param name="forum">The forum associated with the topic.</param>
/// <returns></returns>
RedirectResult AdaptPostLink(Controller controller, Post post, Topic topic, Forum forum);
Task<RedirectResult> AdaptPostLink(Controller controller, Post post, Topic topic, Forum forum);

/// <summary>
/// Set this in the adapter for alternate views from the AdaptForum and AdaptTopic methods.
Expand Down

0 comments on commit 046742e

Please sign in to comment.