From 0a6dbb6b34d8ec4255f3213352e8c7da8ce76f20 Mon Sep 17 00:00:00 2001 From: Leonid Tsarev Date: Wed, 16 Oct 2024 17:15:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D1=83=20=D1=81=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=D1=8E=20=D0=BE=D1=82=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D1=81=D0=BE=D0=BD=D0=B0=D0=B6=D0=B0,=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B3=D0=B4=D0=B0=20=D0=B2=D1=8B=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B3=D1=80=D1=83?= =?UTF-8?q?=D0=BF=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Characters/CharacterViewModelBase.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/JoinRpg.WebPortal.Models/Characters/CharacterViewModelBase.cs b/src/JoinRpg.WebPortal.Models/Characters/CharacterViewModelBase.cs index 2697755fc..e3e63cd89 100644 --- a/src/JoinRpg.WebPortal.Models/Characters/CharacterViewModelBase.cs +++ b/src/JoinRpg.WebPortal.Models/Characters/CharacterViewModelBase.cs @@ -1,7 +1,6 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; using JoinRpg.DataModel; -using JoinRpg.Helpers.Validation; using JoinRpg.PrimitiveTypes; using JoinRpg.PrimitiveTypes.ProjectMetadata; @@ -25,7 +24,7 @@ public abstract class CharacterViewModelBase : IProjectIdAware, IValidatableObje public IEnumerable Validate(ValidationContext validationContext) { - if (!ParentCharacterGroupIds.Any()) + if (AllowToSetGroups && ParentCharacterGroupIds.Length == 0) { yield return new ValidationResult( "Персонаж должен принадлежать хотя бы к одной группе"); @@ -34,11 +33,11 @@ public IEnumerable Validate(ValidationContext validationContex public CustomFieldsViewModel Fields { get; set; } - [CannotBeEmpty, DisplayName("Является частью групп")] + [DisplayName("Является частью групп")] public int[] ParentCharacterGroupIds { get; set; } = []; [ReadOnly(true)] - public bool AllowToSetGroups { get; set; } = true; + public bool AllowToSetGroups { get; set; } protected void FillFields(Character field, int currentUserId, ProjectInfo projectInfo) {