using System.Linq; using xCategoryService.Providers.Dtos; using xCommons.Extensions; namespace xCategoryService.Extensions { /// /// Extensions Method Related to XCategoryResourceDto ... /// public static class XCategoryResourceExtensions { /// /// Check a Resource is Valid or not ... /// /// /// public static bool IsValid( this XCategoryResourceDto source ) { // return !source.IsNullOrDefault() && !source.Item.IsNullOrDefault(); } /// /// Check a Resource is a New Resource for Add or not ... /// /// /// public static bool IsNew( this XCategoryResourceDto source ) { // return source.IsValid() && !source.Item.Id.IsValidIntId(); } /// /// Extract Available Languages ... /// /// /// public static string[] ExtractLanguages( this XCategoryResourceDto source ) { // var result = new string[] { }; // // Validate ... if (!source.IsValid()) { return result; } // result = source.Titles.Locales.Select(x => x.Language) .Union(source.Descriptions.Locales.Select(x => x.Language)) .Distinct() .ToArray(); // return result; } // public static bool ValidateResources( // this XCategoryResourceDto source // ) // { // var result = // } } }