using Microsoft.AspNetCore.Mvc.ModelBinding; using Nop.Core.Events; namespace Nop.Web.Framework.Events; /// /// Represents event publisher extensions /// public static class EventPublisherExtensions { /// /// Publish ModelPrepared event /// /// Type of the model /// Event publisher /// Model /// A task that represents the asynchronous operation public static async Task ModelPreparedAsync(this IEventPublisher eventPublisher, T model) { await eventPublisher.PublishAsync(new ModelPreparedEvent(model)); } /// /// Publish ModelReceived event /// /// Type of the model /// Event publisher /// Model /// Model state /// A task that represents the asynchronous operation public static async Task ModelReceivedAsync(this IEventPublisher eventPublisher, T model, ModelStateDictionary modelState) { await eventPublisher.PublishAsync(new ModelReceivedEvent(model, modelState)); } }