Add validators and services for Product Galleries and Product Tags
- Implemented Create, Delete, Get, and Update validators for Product Galleries. - Added Create, Delete, Get, and Update validators for Product Tags. - Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags. - Each service class integrates with CQRS for command and query handling. - Established mapping profiles for Product Galleries.
This commit is contained in:
+5
-5
@@ -1,10 +1,10 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductCategory;
|
||||
|
||||
public class CreateNewPruductCategoryRequestValidator : AbstractValidator<CreateNewPruductCategoryRequest>
|
||||
public class CreateNewProductCategoryRequestValidator : AbstractValidator<CreateNewProductCategoryRequest>
|
||||
{
|
||||
public CreateNewPruductCategoryRequestValidator()
|
||||
public CreateNewProductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
@@ -13,7 +13,7 @@ public class CreateNewPruductCategoryRequestValidator : AbstractValidator<Create
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewPruductCategoryRequest>.CreateWithOptions((CreateNewPruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewProductCategoryRequest>.CreateWithOptions((CreateNewProductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductCategory;
|
||||
|
||||
public class DeletePruductCategoryRequestValidator : AbstractValidator<DeletePruductCategoryRequest>
|
||||
public class DeleteProductCategoryRequestValidator : AbstractValidator<DeleteProductCategoryRequest>
|
||||
{
|
||||
public DeletePruductCategoryRequestValidator()
|
||||
public DeleteProductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeletePruductCategoryRequest>.CreateWithOptions((DeletePruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<DeleteProductCategoryRequest>.CreateWithOptions((DeleteProductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,15 +1,15 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductCategory;
|
||||
|
||||
public class GetAllPruductCategoryByFilterRequestValidator : AbstractValidator<GetAllPruductCategoryByFilterRequest>
|
||||
public class GetAllProductCategoryByFilterRequestValidator : AbstractValidator<GetAllProductCategoryByFilterRequest>
|
||||
{
|
||||
public GetAllPruductCategoryByFilterRequestValidator()
|
||||
public GetAllProductCategoryByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllPruductCategoryByFilterRequest>.CreateWithOptions((GetAllPruductCategoryByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<GetAllProductCategoryByFilterRequest>.CreateWithOptions((GetAllProductCategoryByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductCategory;
|
||||
|
||||
public class GetPruductCategoryRequestValidator : AbstractValidator<GetPruductCategoryRequest>
|
||||
public class GetProductCategoryRequestValidator : AbstractValidator<GetProductCategoryRequest>
|
||||
{
|
||||
public GetPruductCategoryRequestValidator()
|
||||
public GetProductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetPruductCategoryRequest>.CreateWithOptions((GetPruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<GetProductCategoryRequest>.CreateWithOptions((GetProductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductCategory;
|
||||
|
||||
public class UpdatePruductCategoryRequestValidator : AbstractValidator<UpdatePruductCategoryRequest>
|
||||
public class UpdateProductCategoryRequestValidator : AbstractValidator<UpdateProductCategoryRequest>
|
||||
{
|
||||
public UpdatePruductCategoryRequestValidator()
|
||||
public UpdateProductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
@@ -15,7 +15,7 @@ public class UpdatePruductCategoryRequestValidator : AbstractValidator<UpdatePru
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdatePruductCategoryRequest>.CreateWithOptions((UpdatePruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<UpdateProductCategoryRequest>.CreateWithOptions((UpdateProductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGalleries;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGalleries;
|
||||
|
||||
public class CreateNewProductGallerysRequestValidator : AbstractValidator<CreateNewProductGallerysRequest>
|
||||
public class CreateNewProductGalleriesRequestValidator : AbstractValidator<CreateNewProductGalleriesRequest>
|
||||
{
|
||||
public CreateNewProductGallerysRequestValidator()
|
||||
public CreateNewProductGalleriesRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.ProductImageId)
|
||||
.NotNull();
|
||||
@@ -13,7 +13,7 @@ public class CreateNewProductGallerysRequestValidator : AbstractValidator<Create
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewProductGallerysRequest>.CreateWithOptions((CreateNewProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewProductGalleriesRequest>.CreateWithOptions((CreateNewProductGalleriesRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGalleries;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGalleries;
|
||||
|
||||
public class DeleteProductGallerysRequestValidator : AbstractValidator<DeleteProductGallerysRequest>
|
||||
public class DeleteProductGalleriesRequestValidator : AbstractValidator<DeleteProductGalleriesRequest>
|
||||
{
|
||||
public DeleteProductGallerysRequestValidator()
|
||||
public DeleteProductGalleriesRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteProductGallerysRequest>.CreateWithOptions((DeleteProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<DeleteProductGalleriesRequest>.CreateWithOptions((DeleteProductGalleriesRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGalleries;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGalleries;
|
||||
|
||||
public class GetAllProductGalleriesByFilterRequestValidator : AbstractValidator<GetAllProductGalleriesByFilterRequest>
|
||||
{
|
||||
public GetAllProductGalleriesByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllProductGalleriesByFilterRequest>.CreateWithOptions((GetAllProductGalleriesByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGalleries;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGalleries;
|
||||
|
||||
public class GetProductGallerysRequestValidator : AbstractValidator<GetProductGallerysRequest>
|
||||
public class GetProductGalleriesRequestValidator : AbstractValidator<GetProductGalleriesRequest>
|
||||
{
|
||||
public GetProductGallerysRequestValidator()
|
||||
public GetProductGalleriesRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetProductGallerysRequest>.CreateWithOptions((GetProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<GetProductGalleriesRequest>.CreateWithOptions((GetProductGalleriesRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGalleries;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGalleries;
|
||||
|
||||
public class UpdateProductGallerysRequestValidator : AbstractValidator<UpdateProductGallerysRequest>
|
||||
public class UpdateProductGalleriesRequestValidator : AbstractValidator<UpdateProductGalleriesRequest>
|
||||
{
|
||||
public UpdateProductGallerysRequestValidator()
|
||||
public UpdateProductGalleriesRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
@@ -15,7 +15,7 @@ public class UpdateProductGallerysRequestValidator : AbstractValidator<UpdatePro
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateProductGallerysRequest>.CreateWithOptions((UpdateProductGallerysRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<UpdateProductGalleriesRequest>.CreateWithOptions((UpdateProductGalleriesRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductGallerys;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductGallerys;
|
||||
|
||||
public class GetAllProductGallerysByFilterRequestValidator : AbstractValidator<GetAllProductGallerysByFilterRequest>
|
||||
{
|
||||
public GetAllProductGallerysByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllProductGallerysByFilterRequest>.CreateWithOptions((GetAllProductGallerysByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductTag;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductTag;
|
||||
|
||||
public class CreateNewPruductTagRequestValidator : AbstractValidator<CreateNewPruductTagRequest>
|
||||
public class CreateNewProductTagRequestValidator : AbstractValidator<CreateNewProductTagRequest>
|
||||
{
|
||||
public CreateNewPruductTagRequestValidator()
|
||||
public CreateNewProductTagRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotNull();
|
||||
@@ -13,7 +13,7 @@ public class CreateNewPruductTagRequestValidator : AbstractValidator<CreateNewPr
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewPruductTagRequest>.CreateWithOptions((CreateNewPruductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewProductTagRequest>.CreateWithOptions((CreateNewProductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductTag;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductTag;
|
||||
|
||||
public class DeletePruductTagRequestValidator : AbstractValidator<DeletePruductTagRequest>
|
||||
public class DeleteProductTagRequestValidator : AbstractValidator<DeleteProductTagRequest>
|
||||
{
|
||||
public DeletePruductTagRequestValidator()
|
||||
public DeleteProductTagRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeletePruductTagRequest>.CreateWithOptions((DeletePruductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<DeleteProductTagRequest>.CreateWithOptions((DeleteProductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,15 +1,15 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductTag;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductTag;
|
||||
|
||||
public class GetAllPruductTagByFilterRequestValidator : AbstractValidator<GetAllPruductTagByFilterRequest>
|
||||
public class GetAllProductTagByFilterRequestValidator : AbstractValidator<GetAllProductTagByFilterRequest>
|
||||
{
|
||||
public GetAllPruductTagByFilterRequestValidator()
|
||||
public GetAllProductTagByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllPruductTagByFilterRequest>.CreateWithOptions((GetAllPruductTagByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<GetAllProductTagByFilterRequest>.CreateWithOptions((GetAllProductTagByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductTag;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductTag;
|
||||
|
||||
public class GetPruductTagRequestValidator : AbstractValidator<GetPruductTagRequest>
|
||||
public class GetProductTagRequestValidator : AbstractValidator<GetProductTagRequest>
|
||||
{
|
||||
public GetPruductTagRequestValidator()
|
||||
public GetProductTagRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetPruductTagRequest>.CreateWithOptions((GetPruductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<GetProductTagRequest>.CreateWithOptions((GetProductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductTag;
|
||||
using CMSMicroservice.Protobuf.Protos.ProductTag;
|
||||
namespace CMSMicroservice.Protobuf.Validator.ProductTag;
|
||||
|
||||
public class UpdatePruductTagRequestValidator : AbstractValidator<UpdatePruductTagRequest>
|
||||
public class UpdateProductTagRequestValidator : AbstractValidator<UpdateProductTagRequest>
|
||||
{
|
||||
public UpdatePruductTagRequestValidator()
|
||||
public UpdateProductTagRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
@@ -15,7 +15,7 @@ public class UpdatePruductTagRequestValidator : AbstractValidator<UpdatePruductT
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdatePruductTagRequest>.CreateWithOptions((UpdatePruductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
var result = await ValidateAsync(ValidationContext<UpdateProductTagRequest>.CreateWithOptions((UpdateProductTagRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
Reference in New Issue
Block a user