From ab667e296d73bc4ecdcec6d12cb7907b617f9991 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sun, 7 Jun 2026 04:25:52 +0330 Subject: [PATCH] last ... --- Providers/XCategoryProvider.cs | 78 ++++++++++++++-------------------- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/Providers/XCategoryProvider.cs b/Providers/XCategoryProvider.cs index 1d23280..1617ac5 100644 --- a/Providers/XCategoryProvider.cs +++ b/Providers/XCategoryProvider.cs @@ -9,6 +9,7 @@ using xCommons.Configurations; using xCommons.Extensions; using xExceptions.Constants; using xIdentityModels.Models; +using xModels.Dtos; using xPushService.Providers; namespace xCategoryService.Providers @@ -147,27 +148,33 @@ namespace xCategoryService.Providers // id = item.Id; - var titleResourceTitle = await titleResourceProvider.AddOrUpdateItemResourcer( - identifier: id, - language: langauge, - translation: title, - userInfo: userInfo, - connectionId: connectionId, - cancellationToken: cancellationToken - ); - var descriptionResourceTitle = await descriptionResourceProvider.AddOrUpdateItemResourcer( - identifier: id, - language: langauge, - userInfo: userInfo, - translation: description, - connectionId: connectionId, - cancellationToken: cancellationToken - ); + var titleResource = await titleResourceProvider + .AddOrUpdateLocale( + identifier: id, + locale: new XLocaleResourceDto + { + Value = title, + Language = langauge + }, + connectionId: connectionId, + cancellationToken: cancellationToken + ); + var descriptionResource = await descriptionResourceProvider + .AddOrUpdateLocale( + identifier: id, + locale: new XLocaleResourceDto + { + Value = description, + Language = langauge + }, + connectionId: connectionId, + cancellationToken: cancellationToken + ); // // Update Category Dto ... - item.Title = titleResourceTitle; - item.Description = descriptionResourceTitle; + item.Title = titleResource.Resource; + item.Description = descriptionResource.Resource; item = await base.Update( id: id, item: item, @@ -175,7 +182,6 @@ namespace xCategoryService.Providers connectionId: connectionId, cancellationToken: cancellationToken ); - } catch { @@ -201,33 +207,13 @@ namespace xCategoryService.Providers return result; } - public async Task RemoveResaource( + public async Task Update( int id, - CancellationToken cancellationToken - ) - { - // - // Validate ... - 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(); - } + XCategoryDto item, + string langauge = null, + string connectionId = null, + XUserClaimsInfoDto userInfo = null, + CancellationToken cancellationToken = default + ) {} } } \ No newline at end of file