Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cms-kit tag issues 13417 #13718

Merged
merged 6 commits into from
Aug 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Volo.Abp.Validation.Localization;
using Volo.CmsKit.Localization;
using Volo.CmsKit.Tags;

namespace Volo.CmsKit.Admin.Tags;

[Serializable]
public class EntityTagSetDto
public class EntityTagSetDto : IValidatableObject
{
public string EntityId { get; set; }

public string EntityType { get; set; }

[Required]
public List<string> Tags { get; set; }

public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var l = validationContext.GetRequiredService<IStringLocalizer<AbpValidationResource>>();

foreach (var tag in Tags)
{
if (tag.Length > TagConsts.MaxNameLength)
{
yield return new ValidationResult(
l[
"ThisFieldMustBeAStringWithAMaximumLengthOf{0}",
TagConsts.MaxNameLength
],
new[] { nameof(Tags) }
);
}
}
}
}