last works on Category and SubCategory Completion ...
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xCategoryService.Providers.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Represent a Category by all of it's Resources ...
|
||||
/// </summary>
|
||||
public class XCategoryResourceDto : XBaseDto
|
||||
{
|
||||
public XCategoryDto Item { get; set; }
|
||||
public XResourceDto Titles { get; set; }
|
||||
public XResourceDto Descriptions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using xCategoryService.Models.Dtos;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xCategoryService.Providers.Dtos
|
||||
{
|
||||
public class XSubCategoryResourceDto : XBaseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// SubCategory Dto Item for Add or Update ...
|
||||
/// </summary>
|
||||
public XSubCategoryDto Item { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Exists SubCategory Titles ...
|
||||
/// </summary>
|
||||
public XResourceDto Titles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Exists SubCategory Description ...
|
||||
/// </summary>
|
||||
public XResourceDto Descriptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Exists Category Resource Dto for Add or Update Category or
|
||||
/// Related Categopry ...
|
||||
/// </summary>
|
||||
public XCategoryResourceDto Category { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ namespace xCategoryService.Providers
|
||||
private readonly IXCategoryDescriptionResourceProvider descriptionResourceProvider;
|
||||
private readonly IXCategorySubCategoryReferenceProvider categorySubCategoryReferenceProvider;
|
||||
|
||||
public string Provider => categorySubCategoryReferenceProvider.Provider;
|
||||
|
||||
public XCategoryProvider(
|
||||
XAppConfiguration appConfiguration,
|
||||
IXCategoryServiceProvider provider,
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace xCategoryService.Providers
|
||||
public class XSubCategoryProvider : XBaseProvided<XSubCategory, XSubCategoryDto, int, XSubCategoryDtoHub>, IXSubCategoryProvider
|
||||
{
|
||||
private readonly XAppConfiguration appConfiguration;
|
||||
private readonly IXCategoryProvider categoryProvider;
|
||||
private readonly IXSubCategoryServiceProvider provider;
|
||||
private readonly XDataServiceConfiguration dataServiceConfiguration;
|
||||
private readonly IXSubCategoryTitleResourceProvider titleResourceProvider;
|
||||
@@ -32,6 +33,7 @@ namespace xCategoryService.Providers
|
||||
|
||||
public XSubCategoryProvider(
|
||||
XAppConfiguration appConfiguration,
|
||||
IXCategoryProvider categoryProvider,
|
||||
IXSubCategoryServiceProvider provider,
|
||||
XDataServiceConfiguration dataServiceConfiguration,
|
||||
IXSubCategoryTitleResourceProvider titleResourceProvider,
|
||||
@@ -41,10 +43,11 @@ namespace xCategoryService.Providers
|
||||
permittedRoles: new string[] { }
|
||||
)
|
||||
{
|
||||
this.appConfiguration = appConfiguration;
|
||||
this.provider = provider;
|
||||
this.dataServiceConfiguration = dataServiceConfiguration;
|
||||
this.appConfiguration = appConfiguration;
|
||||
this.categoryProvider = categoryProvider;
|
||||
this.titleResourceProvider = titleResourceProvider;
|
||||
this.dataServiceConfiguration = dataServiceConfiguration;
|
||||
this.descriptionResourceProvider = descriptionResourceProvider;
|
||||
}
|
||||
|
||||
@@ -137,11 +140,27 @@ namespace xCategoryService.Providers
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
// Reading Category Resource ...
|
||||
XCategoryResourceDto categoryResourceDto = null;
|
||||
var categoryDto = await categoryProvider.GetReference(
|
||||
providedForId: id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
if (!categoryDto.IsNullOrDefault())
|
||||
{
|
||||
categoryResourceDto = await categoryProvider.GetResource(
|
||||
id: categoryDto.Id,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
var result = new XSubCategoryResourceDto
|
||||
{
|
||||
Item = item,
|
||||
Titles = titleResource,
|
||||
Category = categoryResourceDto,
|
||||
Descriptions = descriptionResource
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user