Add AddPartner method with SignalR support to controller

Added AddPartner to FruitBankDataController, enabling partner creation via SignalR. The method logs the action, inserts the partner into the database, and returns the newly created partner, including ShippingDocuments if available.
This commit is contained in:
Loretta 2025-12-22 14:37:59 +01:00
parent 8574c2a136
commit 9b5155684e
1 changed files with 11 additions and 0 deletions

View File

@ -113,6 +113,17 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Controllers
return await ctx.Partners.GetByIdAsync(id);
}
[SignalR(SignalRTags.AddPartner)]
public async Task<Partner> AddPartner(Partner partner)
{
ArgumentNullException.ThrowIfNull(partner);
_logger.Detail($"AddPartner invoked; id: {partner.Id}");
await ctx.Partners.InsertAsync(partner);
return await ctx.Partners.GetByIdAsync(partner.Id, partner.ShippingDocuments != null);
}
[SignalR(SignalRTags.UpdatePartner)]
public async Task<Partner> UpdatePartner(Partner partner)
{