Extracted some pages to their own assembly and finished the artifact display page code

This commit is contained in:
Vincent Allen
2025-10-08 13:08:12 -04:00
parent fd0e6290fe
commit 02c2660b09
626 changed files with 39989 additions and 1553 deletions

View File

@@ -6,6 +6,11 @@ using System.ComponentModel.DataAnnotations;
public class ArtifactEntryValidationModel
{
/// <summary>
/// Used when translating between the validation model and the database model
/// </summary>
public int? Id { get; set; }
[Required(AllowEmptyStrings = false, ErrorMessage = "An artifact numbering must be supplied")]
public string? ArtifactNumber { get; set; }
@@ -33,14 +38,8 @@ public class ArtifactEntryValidationModel
public string? FileTextContent { get; set; }
public List<ArtifactEntry> RelatedArtifacts { get; set; } = [];
/*
public IEnumerable<ValidationResult> Validate(ValidationContext context)
{
}
*/
public bool IsPublicallyVisible { get; set; }
public bool IsPublicallyVisible { get; set; } = true;
public ArtifactEntry ToArtifactEntry(ArtifactGrouping? parent = null)
{
@@ -59,10 +58,9 @@ public class ArtifactEntryValidationModel
defects.Add(new ArtifactDefect() { Description=defect});
}
var entry = new ArtifactEntry()
{
Id = Id ?? 0,
Files = Files,
Type = new DataAccess.ArtifactType() { Name = Type },
ArtifactNumber = ArtifactNumber,

View File

@@ -26,7 +26,7 @@ public class ArtifactGroupingValidationModel : IValidatableObject
public List<ArtifactEntryValidationModel> ArtifactEntries { get; set; } = new();
public bool IsPublicallyVisible { get; set; }
public bool IsPublicallyVisible { get; set; } = true;
public ArtifactGrouping ToArtifactGrouping()
{
@@ -75,6 +75,7 @@ public class ArtifactGroupingValidationModel : IValidatableObject
var validationModel = new ArtifactEntryValidationModel()
{
Id = entry.Id,
Title = entry.Title,
StorageLocation = entry.StorageLocation.Location,
ArtifactNumber = entry.ArtifactNumber,
@@ -131,7 +132,7 @@ public class ArtifactGroupingValidationModel : IValidatableObject
}
}
if (ArtifactEntries.IsNullOrEmpty())
if (ArtifactEntries is null || ArtifactEntries.Count == 0)
{
yield return new ValidationResult("Must upload one or more files");
}