Implemented method to calculate a section's path
This commit is contained in:
parent
10952769aa
commit
5428cb9489
@ -137,4 +137,17 @@ public static class SectionProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Section GetSection(DataContext db, string sectionKey) => db.Sections.First(n => n.DataKey == sectionKey);
|
public static Section GetSection(DataContext db, string sectionKey) => db.Sections.First(n => n.DataKey == sectionKey);
|
||||||
|
|
||||||
|
public static string GetSectionPath(DataContext db, string sectionKey)
|
||||||
|
{
|
||||||
|
var section = db.Sections.First(n => n.DataKey == sectionKey);
|
||||||
|
var path = section.Name;
|
||||||
|
while (section.Parent != null)
|
||||||
|
{
|
||||||
|
section = section.Parent;
|
||||||
|
path = $"{section.Name}/{path}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"Section's path: {path}";
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user