I have a list of object and i need to save those objects with some details.I need to validate those image files using IValidatable
I am stuck on some point any help will appreciated thanks!
//in class one public void submit button(){ foreach (var imageFile in ImageList) { await using var file = imageFile.File.OpenReadStream(MaxUploadFileSize) var ObjToDB = objclass .ToDB(); } } //in class two public class objclass : IValidatableObject { public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { //1.need to check the content type //2.need to check the name is there //3.need to check the list is empty or not } public string Name { get; set; } public string FileContentType { get; set; } //FileContentType how to validate for MIME types using ivalidatable public modelclass ToDB() { return new() { Name = Name, ContentType = FileContentType, }; } }