last ...
This commit is contained in:
@@ -45,6 +45,155 @@ namespace xCategoryService.Controllers
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
//
|
||||
#region Overrides ...
|
||||
[NonAction]
|
||||
[HttpGet("{id}")]
|
||||
public override async Task<ActionResult<XCategoryDto>> Get(
|
||||
[FromRoute] int id,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Get(
|
||||
id: id,
|
||||
useDefaultIncludes: useDefaultIncludes,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("")]
|
||||
public override async Task<ActionResult<IEnumerable<XCategoryDto>>> GetAll(
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.GetAll(
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Find/One")]
|
||||
public override async Task<ActionResult<XCategoryDto>> FindOne(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.FindOne(
|
||||
query: query,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Find/Many")]
|
||||
public override async Task<ActionResult<IEnumerable<XCategoryDto>>> FindMany(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.FindMany(
|
||||
query: query,
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Query")]
|
||||
public override async Task<ActionResult<XQueryResult<XCategoryDto>>> Query(
|
||||
[FromQuery] XQuery query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Query(
|
||||
query: query,
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Query/Owned")]
|
||||
public override async Task<ActionResult<XQueryResult<XCategoryDto>>> QueryOwned(
|
||||
[FromQuery] XQuery query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.QueryOwned(
|
||||
query: query,
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpPost("")]
|
||||
public override async Task<ActionResult<XCategoryDto>> Add(
|
||||
[FromBody] XCategoryDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Add(
|
||||
item: item,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpPut("{id}")]
|
||||
public override async Task<ActionResult<XCategoryDto>> Update(
|
||||
[FromRoute] int id,
|
||||
[FromBody] XCategoryDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Update(
|
||||
id: id,
|
||||
item: item,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpDelete("{id}")]
|
||||
public override async Task<ActionResult<XCategoryDto>> Remove(
|
||||
[FromRoute] int id,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Remove(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Actions ...
|
||||
/// <summary>
|
||||
@@ -187,6 +336,56 @@ namespace xCategoryService.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("Resources/{id}")]
|
||||
public virtual async Task<ActionResult<XCategoryResourceDto>> Remove(
|
||||
[FromRoute] int id,
|
||||
[FromQuery] string language = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid ||
|
||||
!id.IsValidIntId())
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Reading Requirements ...
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await provider.Remove(
|
||||
id: id,
|
||||
language: language,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update a Category Item for Specified Language ...
|
||||
/// </summary>
|
||||
|
||||
@@ -45,6 +45,155 @@ namespace xCategoryService.Controllers
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
//
|
||||
#region Overrides ...
|
||||
[NonAction]
|
||||
[HttpGet("{id}")]
|
||||
public override async Task<ActionResult<XSubCategoryDto>> Get(
|
||||
[FromRoute] int id,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Get(
|
||||
id: id,
|
||||
useDefaultIncludes: useDefaultIncludes,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("")]
|
||||
public override async Task<ActionResult<IEnumerable<XSubCategoryDto>>> GetAll(
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.GetAll(
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Find/One")]
|
||||
public override async Task<ActionResult<XSubCategoryDto>> FindOne(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.FindOne(
|
||||
query: query,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Find/Many")]
|
||||
public override async Task<ActionResult<IEnumerable<XSubCategoryDto>>> FindMany(
|
||||
[FromRoute] string query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.FindMany(
|
||||
query: query,
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Query")]
|
||||
public override async Task<ActionResult<XQueryResult<XSubCategoryDto>>> Query(
|
||||
[FromQuery] XQuery query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Query(
|
||||
query: query,
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpGet("Query/Owned")]
|
||||
public override async Task<ActionResult<XQueryResult<XSubCategoryDto>>> QueryOwned(
|
||||
[FromQuery] XQuery query,
|
||||
[FromQuery] bool useDefaultOrders = false,
|
||||
[FromQuery] bool useDefaultIncludes = false,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.QueryOwned(
|
||||
query: query,
|
||||
useDefaultOrders: useDefaultOrders,
|
||||
cancellationToken: cancellationToken,
|
||||
useDefaultIncludes: useDefaultIncludes
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpPost("")]
|
||||
public override async Task<ActionResult<XSubCategoryDto>> Add(
|
||||
[FromBody] XSubCategoryDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Add(
|
||||
item: item,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpPut("{id}")]
|
||||
public override async Task<ActionResult<XSubCategoryDto>> Update(
|
||||
[FromRoute] int id,
|
||||
[FromBody] XSubCategoryDto item,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Update(
|
||||
id: id,
|
||||
item: item,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[HttpDelete("{id}")]
|
||||
public override async Task<ActionResult<XSubCategoryDto>> Remove(
|
||||
[FromRoute] int id,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
return await base.Remove(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Actions ...
|
||||
/// <summary>
|
||||
@@ -187,6 +336,56 @@ namespace xCategoryService.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("Resources/{id}")]
|
||||
public virtual async Task<ActionResult<XSubCategoryResourceDto>> Remove(
|
||||
[FromRoute] int id,
|
||||
[FromQuery] string language = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!ModelState.IsValid ||
|
||||
!id.IsValidIntId())
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Reading Requirements ...
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await provider.Remove(
|
||||
id: id,
|
||||
language: language,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update a Category Item for Specified Language ...
|
||||
/// </summary>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Category Item for Specified Language ...
|
||||
/// Add Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="language"></param>
|
||||
@@ -57,7 +57,24 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Category Item for Specified Language ...
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XCategoryResourceDto> Remove(
|
||||
int id,
|
||||
string language = null,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update an Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="item"></param>
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Category Item for Specified Language ...
|
||||
/// Add Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="language"></param>
|
||||
@@ -53,7 +53,21 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Category Item for Specified Language ...
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("Resources/{id}")]
|
||||
Task<ActionResult<XCategoryResourceDto>> Remove(
|
||||
[FromRoute] int id,
|
||||
[FromQuery] string language = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update an Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="item"></param>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Category Item for Specified Language ...
|
||||
/// Add Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="language"></param>
|
||||
@@ -57,7 +57,24 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Category Item for Specified Language ...
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<XSubCategoryResourceDto> Remove(
|
||||
int id,
|
||||
string language = null,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update an Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="item"></param>
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Category Item for Specified Language ...
|
||||
/// Add Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="language"></param>
|
||||
@@ -53,7 +53,21 @@ namespace xCategoryService.Interfaces
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Category Item for Specified Language ...
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("Resources/{id}")]
|
||||
Task<ActionResult<XSubCategoryResourceDto>> Remove(
|
||||
[FromRoute] int id,
|
||||
[FromQuery] string language = null,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update an Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="item"></param>
|
||||
|
||||
+296
-86
@@ -88,7 +88,7 @@ namespace xCategoryService.Providers
|
||||
var isValid =
|
||||
id.IsValidIntId() &&
|
||||
!language.IsNullOrEmpty();
|
||||
if (isValid)
|
||||
if (!isValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
@@ -133,7 +133,7 @@ namespace xCategoryService.Providers
|
||||
identifier: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
var descriptionResource = await titleResourceProvider.GetResource(
|
||||
var descriptionResource = await descriptionResourceProvider.GetResource(
|
||||
identifier: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
@@ -289,6 +289,189 @@ namespace xCategoryService.Providers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XCategoryResourceDto> Remove(
|
||||
int id,
|
||||
string language = null,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
var isValid = id.IsValidIntId();
|
||||
if (!isValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Item Exists ...
|
||||
isValid = await IsExists(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Locale if Provided ...
|
||||
isValid =
|
||||
language.IsNullOrEmpty() ||
|
||||
await HasLocale(
|
||||
id: id,
|
||||
language: language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
var result = await GetResource(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (language.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
// Remove All ...
|
||||
|
||||
//
|
||||
// Titles ...
|
||||
await titleResourceProvider.RemoveLocales(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
await descriptionResourceProvider.RemoveLocales(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Remove Entity ...
|
||||
await provider.RemoveAsync(
|
||||
id: id,
|
||||
softDelete: false,
|
||||
saveChanges: true,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
isValid = true;
|
||||
result.Titles.Locales = [];
|
||||
result.Descriptions.Locales = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Remove Only One Locale, and if there is one, Remove all ...
|
||||
|
||||
//
|
||||
// Remove Title if Exists ...
|
||||
isValid = await titleResourceProvider.HasLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Description if Exists ...
|
||||
isValid = await descriptionResourceProvider.HasLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Resource ...
|
||||
result = await GetResource(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Check Has Locales ...
|
||||
isValid = result.Titles.Locales.HasChild();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
// Remove Item ...
|
||||
await provider.RemoveAsync(
|
||||
id: id,
|
||||
softDelete: false,
|
||||
saveChanges: true,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
result.Titles.Locales = [];
|
||||
result.Descriptions.Locales = [];
|
||||
}
|
||||
|
||||
//
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
//
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
// Send Push ...
|
||||
await provider.SendPush(
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken,
|
||||
payLoad: result.ToJSON(camelCase: true),
|
||||
action:
|
||||
result.Titles.Locales.HasChild()
|
||||
? "DeleteLocale"
|
||||
: XBaseEntityHubAction.Delete.GetStringValue()
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update an Item for Specified Language ...
|
||||
/// </summary>
|
||||
@@ -460,6 +643,7 @@ namespace xCategoryService.Providers
|
||||
|
||||
//
|
||||
var id = -1;
|
||||
var isDelete = false;
|
||||
XCategoryResourceDto result = null;
|
||||
|
||||
//
|
||||
@@ -564,7 +748,7 @@ namespace xCategoryService.Providers
|
||||
// Add Descriptions ...
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
locale: desLocale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
@@ -581,109 +765,130 @@ namespace xCategoryService.Providers
|
||||
// Try to Refresh Resource State ...
|
||||
|
||||
//
|
||||
#region Remove ...
|
||||
//
|
||||
// Titles ...
|
||||
var removeTitles = result.Titles.Locales.Where(
|
||||
l => !resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in removeTitles)
|
||||
// Check Delete ...
|
||||
isDelete = !resource.Titles.Locales.HasChild();
|
||||
if (isDelete)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
// Handle Delete ...
|
||||
await Remove(
|
||||
id: id,
|
||||
language: null,
|
||||
userInfo: userInfo,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Handle Update ...
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var removeDescriptions = result.Descriptions.Locales.Where(
|
||||
l => !resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in removeDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
#region Remove ...
|
||||
//
|
||||
// Titles ...
|
||||
var removeTitles = result.Titles.Locales.Where(
|
||||
l => !resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
foreach (var locale in removeTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
#region Update ...
|
||||
//
|
||||
// Titles ...
|
||||
var updateTitles = result.Titles.Locales.Where(
|
||||
l => resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in updateTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
// Descriptions ...
|
||||
var removeDescriptions = result.Descriptions.Locales.Where(
|
||||
l => !resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
foreach (var locale in removeDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var updateDescriptions = result.Descriptions.Locales.Where(
|
||||
l => resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in updateDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
#region Update ...
|
||||
//
|
||||
// Titles ...
|
||||
var updateTitles = result.Titles.Locales.Where(
|
||||
l => resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
foreach (var locale in updateTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
#region New ...
|
||||
//
|
||||
// Titles ...
|
||||
var newTitles = resource.Titles.Locales.Where(
|
||||
l => !result.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
// Descriptions ...
|
||||
var updateDescriptions = result.Descriptions.Locales.Where(
|
||||
l => resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
foreach (var locale in updateDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var newDescriptions = resource.Descriptions.Locales.Where(
|
||||
l => !result.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
#region New ...
|
||||
//
|
||||
// Titles ...
|
||||
var newTitles = resource.Titles.Locales.Where(
|
||||
l => !result.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var newDescriptions = resource.Descriptions.Locales.Where(
|
||||
l => !result.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
//
|
||||
@@ -696,7 +901,10 @@ namespace xCategoryService.Providers
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
result = await GetResource(
|
||||
result =
|
||||
isDelete
|
||||
? resource
|
||||
: await GetResource(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
@@ -713,7 +921,9 @@ namespace xCategoryService.Providers
|
||||
payLoad: result.ToJSON(camelCase: true),
|
||||
action: isNew
|
||||
? XBaseEntityHubAction.Add.GetStringValue()
|
||||
: XBaseEntityHubAction.Update.GetStringValue()
|
||||
: isDelete
|
||||
? XBaseEntityHubAction.Delete.GetStringValue()
|
||||
: XBaseEntityHubAction.Update.GetStringValue()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace xCategoryService.Providers
|
||||
var isValid =
|
||||
id.IsValidIntId() &&
|
||||
!language.IsNullOrEmpty();
|
||||
if (isValid)
|
||||
if (!isValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
@@ -288,6 +288,189 @@ namespace xCategoryService.Providers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove Item for Specified Language ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="language">if null, Remove All</param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XSubCategoryResourceDto> Remove(
|
||||
int id,
|
||||
string language = null,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
var isValid = id.IsValidIntId();
|
||||
if (!isValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Item Exists ...
|
||||
isValid = await IsExists(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Locale if Provided ...
|
||||
isValid =
|
||||
language.IsNullOrEmpty() ||
|
||||
await HasLocale(
|
||||
id: id,
|
||||
language: language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
var result = await GetResource(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (language.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
// Remove All ...
|
||||
|
||||
//
|
||||
// Titles ...
|
||||
await titleResourceProvider.RemoveLocales(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
await descriptionResourceProvider.RemoveLocales(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Remove Entity ...
|
||||
await provider.RemoveAsync(
|
||||
id: id,
|
||||
softDelete: false,
|
||||
saveChanges: true,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
isValid = true;
|
||||
result.Titles.Locales = [];
|
||||
result.Descriptions.Locales = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Remove Only One Locale, and if there is one, Remove all ...
|
||||
|
||||
//
|
||||
// Remove Title if Exists ...
|
||||
isValid = await titleResourceProvider.HasLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Description if Exists ...
|
||||
isValid = await descriptionResourceProvider.HasLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
language: language,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Resource ...
|
||||
result = await GetResource(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Check Has Locales ...
|
||||
isValid = result.Titles.Locales.HasChild();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
// Remove Item ...
|
||||
await provider.RemoveAsync(
|
||||
id: id,
|
||||
softDelete: false,
|
||||
saveChanges: true,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
result.Titles.Locales = [];
|
||||
result.Descriptions.Locales = [];
|
||||
}
|
||||
|
||||
//
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
//
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
// Send Push ...
|
||||
await provider.SendPush(
|
||||
connectionId: connectionId,
|
||||
cancellationToken: cancellationToken,
|
||||
payLoad: result.ToJSON(camelCase: true),
|
||||
action:
|
||||
result.Titles.Locales.HasChild()
|
||||
? "DeleteLocale"
|
||||
: XBaseEntityHubAction.Delete.GetStringValue()
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update an Item for Specified Language ...
|
||||
/// </summary>
|
||||
@@ -459,6 +642,7 @@ namespace xCategoryService.Providers
|
||||
|
||||
//
|
||||
var id = -1;
|
||||
var isDelete = false;
|
||||
XSubCategoryResourceDto result = null;
|
||||
|
||||
//
|
||||
@@ -580,109 +764,130 @@ namespace xCategoryService.Providers
|
||||
// Try to Refresh Resource State ...
|
||||
|
||||
//
|
||||
#region Remove ...
|
||||
//
|
||||
// Titles ...
|
||||
var removeTitles = result.Titles.Locales.Where(
|
||||
l => !resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in removeTitles)
|
||||
// Check Delete ...
|
||||
isDelete = !resource.Titles.Locales.HasChild();
|
||||
if (isDelete)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
// Handle Delete ...
|
||||
await Remove(
|
||||
id: id,
|
||||
language: null,
|
||||
userInfo: userInfo,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Handle Update ...
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var removeDescriptions = result.Descriptions.Locales.Where(
|
||||
l => !resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in removeDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
#region Remove ...
|
||||
//
|
||||
// Titles ...
|
||||
var removeTitles = result.Titles.Locales.Where(
|
||||
l => !resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
foreach (var locale in removeTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
#region Update ...
|
||||
//
|
||||
// Titles ...
|
||||
var updateTitles = result.Titles.Locales.Where(
|
||||
l => resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in updateTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
// Descriptions ...
|
||||
var removeDescriptions = result.Descriptions.Locales.Where(
|
||||
l => !resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
foreach (var locale in removeDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.RemoveLocale(
|
||||
identifier: id,
|
||||
connectionId: null,
|
||||
language: locale.Language,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var updateDescriptions = result.Descriptions.Locales.Where(
|
||||
l => resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in updateDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
#region Update ...
|
||||
//
|
||||
// Titles ...
|
||||
var updateTitles = result.Titles.Locales.Where(
|
||||
l => resource.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
foreach (var locale in updateTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
#region New ...
|
||||
//
|
||||
// Titles ...
|
||||
var newTitles = resource.Titles.Locales.Where(
|
||||
l => !result.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
// Descriptions ...
|
||||
var updateDescriptions = result.Descriptions.Locales.Where(
|
||||
l => resource.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
}
|
||||
foreach (var locale in updateDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var newDescriptions = resource.Descriptions.Locales.Where(
|
||||
l => !result.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
#region New ...
|
||||
//
|
||||
// Titles ...
|
||||
var newTitles = resource.Titles.Locales.Where(
|
||||
l => !result.Titles.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newTitles)
|
||||
{
|
||||
//
|
||||
await titleResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Descriptions ...
|
||||
var newDescriptions = resource.Descriptions.Locales.Where(
|
||||
l => !result.Descriptions.Locales.Any(r => r.Language.Equals(l.Language, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
);
|
||||
foreach (var locale in newDescriptions)
|
||||
{
|
||||
//
|
||||
await descriptionResourceProvider.AddOrUpdateLocale(
|
||||
identifier: id,
|
||||
locale: locale,
|
||||
connectionId: null,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
//
|
||||
@@ -695,7 +900,10 @@ namespace xCategoryService.Providers
|
||||
|
||||
//
|
||||
// Get Result ...
|
||||
result = await GetResource(
|
||||
result =
|
||||
isDelete
|
||||
? resource
|
||||
: await GetResource(
|
||||
id: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
@@ -712,7 +920,9 @@ namespace xCategoryService.Providers
|
||||
payLoad: result.ToJSON(camelCase: true),
|
||||
action: isNew
|
||||
? XBaseEntityHubAction.Add.GetStringValue()
|
||||
: XBaseEntityHubAction.Update.GetStringValue()
|
||||
: isDelete
|
||||
? XBaseEntityHubAction.Delete.GetStringValue()
|
||||
: XBaseEntityHubAction.Update.GetStringValue()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,4 +32,11 @@
|
||||
<ProjectReference Include="../xStringService/xStringService.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- For XML Documentation Support -->
|
||||
<PropertyGroup>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user