diff --git a/Controllers/XTagServiceControllerBase.cs b/Controllers/XTagServiceControllerBase.cs
new file mode 100644
index 0000000..98c4d14
--- /dev/null
+++ b/Controllers/XTagServiceControllerBase.cs
@@ -0,0 +1,445 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+using xCommons.Configurations;
+using xCommons.Extensions;
+using xCommons.Providers;
+using xIdentityService.Controllers;
+using xIdentityService.Interfaces;
+using xModels.Dtos;
+using xTagService.Interfaces;
+using xTagService.Models.Dtos;
+using xTagService.Models.Entities;
+
+namespace xTagService.Controllers
+{
+ public class XTagServiceControllerBase : XIBaseProviderController, IXTagServiceControllerActions
+ {
+ //
+ #region Props ...
+ public IXTagProvider TagProvider { get; }
+ #endregion
+
+ //
+ #region Constructor ...
+ public XTagServiceControllerBase(
+ ILogger logger,
+ IXTagProvider tagProvider,
+ XAppConfiguration appConfiguration,
+ IXIdentityProvider identityProvider,
+ XValidationProvider validationProvider
+ ) : base(
+ logger,
+ appConfiguration,
+ identityProvider,
+ validationProvider
+ )
+ {
+ //
+ TagProvider = tagProvider;
+ }
+ #endregion
+
+ //
+ #region Actions ...
+ ///
+ /// Add Tag by Providing Dto ...
+ ///
+ ///
+ ///
+ [HttpPost("Add")]
+ public async Task> Add(
+ [FromBody] XTagDto model
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ // Retrieve User Info ...
+ var userInfo = await GetUserInfo();
+ var connectionId = GetConnectionId();
+ bool isAdmin = userInfo.Roles.Any(r => r.ToNormalString() == "admin");
+ var userId = userInfo.UserId;
+
+ //
+ var result = await TagProvider.Add(
+ model: model,
+ connectionId: connectionId
+ );
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Update Specified Tag ...
+ ///
+ ///
+ ///
+ ///
+ [HttpPut("Update")]
+ public async Task> Update(
+ [FromQuery] int id,
+ [FromBody] XTagDto model
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ // Retrieve User Info ...
+ var userInfo = await GetUserInfo();
+ var connectionId = GetConnectionId();
+ bool isAdmin = userInfo.Roles.Any(r => r.ToNormalString() == "admin");
+ var userId = userInfo.UserId;
+
+ //
+ var result = await TagProvider.Update(
+ id: id,
+ model: model,
+ connectionId: connectionId
+ );
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Remove Specified Tag by ID ...
+ ///
+ ///
+ ///
+ [HttpDelete("Remove")]
+ public async Task> Remove(
+ [FromQuery] int id
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ // Retrieve User Info ...
+ var userInfo = await GetUserInfo();
+ var connectionId = GetConnectionId();
+ bool isAdmin = userInfo.Roles.Any(r => r.ToNormalString() == "admin");
+ var userId = userInfo.UserId;
+
+ //
+ var result = await TagProvider.Remove(
+ id: id,
+ connectionId: connectionId
+ );
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Retrieve Specified Tag Dto by ID ...
+ ///
+ ///
+ ///
+ [HttpGet("")]
+ public async Task> Get(
+ [FromQuery] int id
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await TagProvider.Get(
+ id: id
+ );
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Retrieve Specified Tag Dto by it's Label ...
+ ///
+ ///
+ ///
+ [HttpGet("GetTag")]
+ public async Task> GetTag(
+ [FromQuery] string tag
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await TagProvider.GetTag(
+ tag: tag
+ );
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Retrieve All Exists Tags ...
+ ///
+ ///
+ [HttpGet("All")]
+ public async Task>> GetAll()
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await TagProvider.GetAll();
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Search For Specified Tag by Providing a query on Label ...
+ ///
+ ///
+ ///
+ [HttpGet("FindOne")]
+ public async Task> FindOne(
+ [FromQuery] string query
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ Expression> whereClause = t =>
+ !query.IsNullOrEmpty() &&
+ t.Tag.ToNormalString()
+ .Contains(query.ToNormalString());
+ var result = await TagProvider.FindOne(
+ whereClause: whereClause
+ );
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Search For Specified Tags By Providing Query on Labels ...
+ ///
+ ///
+ ///
+ [HttpGet("FindMany")]
+ public async Task>> FindMany(
+ [FromQuery] string query
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ Expression> whereClause = t =>
+ !query.IsNullOrEmpty() &&
+ t.Tag.ToNormalString()
+ .Contains(query.ToNormalString());
+ var result = await TagProvider.FindMany(
+ whereClause: whereClause
+ );
+
+ //
+ return Ok(result
+ .ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Retrieve Tags based on Query Model ...
+ ///
+ ///
+ ///
+ [HttpGet("Query")]
+ public async Task>> Query(
+ [FromQuery] XQuery query
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await TagProvider
+ .Query(query);
+
+ //
+ return Ok(result.
+ ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Count Exists Tags ...
+ ///
+ ///
+ [HttpGet("Count")]
+ public async Task> Count()
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await TagProvider
+ .Count();
+
+ //
+ return Ok(result.
+ ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Check Tag Exists by ID ...
+ ///
+ ///
+ ///
+ [HttpGet("IsExists")]
+ public async Task> IsExists(
+ [FromRoute] int id
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await TagProvider
+ .IsExists(id);
+
+ //
+ return Ok(result.
+ ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Check Tag Exists by Providing Label ...
+ ///
+ ///
+ ///
+ [HttpGet("IsTagExists")]
+ public async Task> IsTagExists(
+ [FromQuery] string tag
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await TagProvider
+ .IsTagExists(tag);
+
+ //
+ return Ok(result.
+ ToDynamicObject());
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Interfaces/IXTagProvider.cs b/Interfaces/IXTagProvider.cs
index d1ad233..b29958a 100644
--- a/Interfaces/IXTagProvider.cs
+++ b/Interfaces/IXTagProvider.cs
@@ -4,7 +4,6 @@ using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using xDataService.Configuration;
-using xIdentityModels.Models;
using xIdentityService.Interfaces;
using xModels.Dtos;
using xTagService.Hubs;
@@ -54,8 +53,12 @@ namespace xTagService.Interfaces
/// Add Specified Tag ...
///
///
+ ///
///
- Task Add(XTagDto model);
+ Task Add(
+ XTagDto model,
+ string connectionId = null
+ );
///
/// Retrieve Specified Item as Dto ...
@@ -113,9 +116,11 @@ namespace xTagService.Interfaces
/// Remove Specified Dto ...
///
///
+ ///
///
Task Remove(
- int id
+ int id,
+ string connectionId = null
);
///
@@ -123,10 +128,12 @@ namespace xTagService.Interfaces
///
///
///
+ ///
///
Task Update(
int id,
- XTagDto model
+ XTagDto model,
+ string connectionId = null
);
///
diff --git a/Interfaces/IXTagServiceControllerActions.cs b/Interfaces/IXTagServiceControllerActions.cs
new file mode 100644
index 0000000..ac20db3
--- /dev/null
+++ b/Interfaces/IXTagServiceControllerActions.cs
@@ -0,0 +1,100 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using xModels.Dtos;
+using xTagService.Models.Dtos;
+
+namespace xTagService.Interfaces
+{
+ public interface IXTagServiceControllerActions
+ {
+ //
+ #region Actions ...
+ ///
+ /// Add Tag by Providing Dto ...
+ ///
+ ///
+ ///
+ Task> Add(XTagDto model);
+
+ ///
+ /// Retrieve Specified Tag Dto by ID ...
+ ///
+ ///
+ ///
+ Task> Get(int id);
+
+ ///
+ /// Retrieve Specified Tag Dto by it's Label ...
+ ///
+ ///
+ ///
+ Task> GetTag(string tag);
+
+ ///
+ /// Retrieve All Exists Tags ...
+ ///
+ ///
+ Task>> GetAll();
+
+ ///
+ /// Search For Specified Tag by Providing a query on Label ...
+ ///
+ ///
+ ///
+ Task> FindOne(string query);
+
+ ///
+ /// Search For Specified Tags By Providing Query on Labels ...
+ ///
+ ///
+ ///
+ Task>> FindMany(string query);
+
+ ///
+ /// Retrieve Tags based on Query Model ...
+ ///
+ ///
+ ///
+ Task>> Query(XQuery query);
+
+ ///
+ /// Update Specified Tag ...
+ ///
+ ///
+ ///
+ ///
+ Task> Update(
+ int id,
+ XTagDto model
+ );
+
+ ///
+ /// Remove Specified Tag by ID ...
+ ///
+ ///
+ ///
+ Task> Remove(int id);
+
+ ///
+ /// Count Exists Tags ...
+ ///
+ ///
+ Task> Count();
+
+ ///
+ /// Check Tag Exists by ID ...
+ ///
+ ///
+ ///
+ Task> IsExists(int id);
+
+ ///
+ /// Check Tag Exists by Providing Label ...
+ ///
+ ///
+ ///
+ Task> IsTagExists(string tag);
+ #endregion
+ }
+}
\ No newline at end of file