using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; namespace LCU.Library.Internal.FileOperationsModels.Models.ExcelModels.Requests; public class ExcelDataRequest { [Required(AllowEmptyStrings = false, ErrorMessage = "FileContent is required")] public string FileContent { get; set; } public List SheetRequests { get; set; } = null; public bool SkipSheetForExtraction(string sheetName, out SheetRequest currentSheetRequest) { currentSheetRequest = SheetRequests is null || !SheetRequests.Any() ? null : SheetRequests.FirstOrDefault(sheetReq => sheetReq.SheetName == sheetName); if (this is not null && SheetRequests is not null && SheetRequests.Any() && currentSheetRequest is null) { return true; } currentSheetRequest ??= new SheetRequest(); return false; } }