last ...
This commit is contained in:
@@ -9,6 +9,7 @@ using xCommons.Configurations;
|
|||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
using xExceptions.Constants;
|
using xExceptions.Constants;
|
||||||
using xIdentityModels.Models;
|
using xIdentityModels.Models;
|
||||||
|
using xModels.Dtos;
|
||||||
using xPushService.Providers;
|
using xPushService.Providers;
|
||||||
|
|
||||||
namespace xCategoryService.Providers
|
namespace xCategoryService.Providers
|
||||||
@@ -147,27 +148,33 @@ namespace xCategoryService.Providers
|
|||||||
|
|
||||||
//
|
//
|
||||||
id = item.Id;
|
id = item.Id;
|
||||||
var titleResourceTitle = await titleResourceProvider.AddOrUpdateItemResourcer(
|
var titleResource = await titleResourceProvider
|
||||||
|
.AddOrUpdateLocale(
|
||||||
identifier: id,
|
identifier: id,
|
||||||
language: langauge,
|
locale: new XLocaleResourceDto
|
||||||
translation: title,
|
{
|
||||||
userInfo: userInfo,
|
Value = title,
|
||||||
|
Language = langauge
|
||||||
|
},
|
||||||
connectionId: connectionId,
|
connectionId: connectionId,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
var descriptionResourceTitle = await descriptionResourceProvider.AddOrUpdateItemResourcer(
|
var descriptionResource = await descriptionResourceProvider
|
||||||
|
.AddOrUpdateLocale(
|
||||||
identifier: id,
|
identifier: id,
|
||||||
language: langauge,
|
locale: new XLocaleResourceDto
|
||||||
userInfo: userInfo,
|
{
|
||||||
translation: description,
|
Value = description,
|
||||||
|
Language = langauge
|
||||||
|
},
|
||||||
connectionId: connectionId,
|
connectionId: connectionId,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update Category Dto ...
|
// Update Category Dto ...
|
||||||
item.Title = titleResourceTitle;
|
item.Title = titleResource.Resource;
|
||||||
item.Description = descriptionResourceTitle;
|
item.Description = descriptionResource.Resource;
|
||||||
item = await base.Update(
|
item = await base.Update(
|
||||||
id: id,
|
id: id,
|
||||||
item: item,
|
item: item,
|
||||||
@@ -175,7 +182,6 @@ namespace xCategoryService.Providers
|
|||||||
connectionId: connectionId,
|
connectionId: connectionId,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -201,33 +207,13 @@ namespace xCategoryService.Providers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> RemoveResaource(
|
public async Task<XCategoryResourceDto> Update(
|
||||||
int id,
|
int id,
|
||||||
CancellationToken cancellationToken
|
XCategoryDto item,
|
||||||
)
|
string langauge = null,
|
||||||
{
|
string connectionId = null,
|
||||||
//
|
XUserClaimsInfoDto userInfo = null,
|
||||||
// Validate ...
|
CancellationToken cancellationToken = default
|
||||||
var isValid = id.IsValidIntId();
|
) {}
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
XException.InvalidArgs.Throw();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Retrieve Resource ...
|
|
||||||
var resource = await GetResource(
|
|
||||||
id: id,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
isValid = !resource.IsNullOrDefault();
|
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
XException.NotFound.Throw();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
await titleResourceProvider.RemoveResource();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user