protected override void OnSaving(SavingEventArgs args) { ValidationErros = Entity.Validate().ToList(); if (ValidationErros.Any()) { StateHasChanged(); args.CanSave = false; } }
protected override async Task RefreshActionAsync() { await base.RefreshActionAsync(); ValidationErros.Clear(); Schema = await ContentService.GetContentSchemaAsync(EntityType); if (IsNewEntity) { Entity = Schema.CreateContentItem(); if (CloneFromEntityId != null) { ContentItem original = await ContentService.GetContentItemAsync(EntityType, CloneFromEntityId.Value); Entity.Fields = original.Fields; } } else { Entity = await ContentService.GetContentItemAsync(EntityType, EntityId); } }
public bool IsFieldValid(string field) { return(ValidationErros.All(x => x.Field != field)); }