Initial ...
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Extensions;
|
||||
using xPushService.Base;
|
||||
using xPushService.Constants;
|
||||
using xStringService.Models.Entities;
|
||||
|
||||
namespace xServices.TermsConditions.Push
|
||||
{
|
||||
public class XTermsHub : XBaseHub
|
||||
{
|
||||
public XTermsHub(ILogger<XBaseHub> logger) : base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
#region Hub Actions ...
|
||||
/// <summary>
|
||||
/// Add Specified Terms and Conditions ...
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Add(XString entity)
|
||||
{
|
||||
//
|
||||
var connectionId = Context.ConnectionId;
|
||||
if (!connectionId.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
await Clients
|
||||
.AllExcept(connectionId)
|
||||
.SendAsync(
|
||||
XBaseEntityHubAction.Add.GetStringValue(),
|
||||
entity.ToJSON(camelCase: true),
|
||||
connectionId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deleted Specified Terms and Conditions ...
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Delete(XString entity)
|
||||
{
|
||||
//
|
||||
var connectionId = Context.ConnectionId;
|
||||
if (!connectionId.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
await Clients
|
||||
.AllExcept(connectionId)
|
||||
.SendAsync(
|
||||
XBaseEntityHubAction.Delete.GetStringValue(),
|
||||
entity.ToJSON(camelCase: true),
|
||||
connectionId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notify an Entity Updated ...
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Update(XString entity)
|
||||
{
|
||||
//
|
||||
var connectionId = Context.ConnectionId;
|
||||
if (!connectionId.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
await Clients
|
||||
.AllExcept(connectionId)
|
||||
.SendAsync(
|
||||
XBaseEntityHubAction.Update.GetStringValue(),
|
||||
entity.ToJSON(camelCase: true),
|
||||
connectionId
|
||||
);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user