#53 cat parents

This commit is contained in:
Hamid Reza Mohammadi 2020-12-21 21:25:21 +03:30
parent acbe582f58
commit ca73dc7e84

View File

@ -91,6 +91,16 @@ namespace RMuseum.Services.Implementation
if (cat == null)
return new RServiceResult<GanjoorPoetCompleteViewModel>(null);
if(cat.Parent != null)
{
var parent = cat.Parent;
while(parent.ParentId != null)
{
parent.Parent = await _context.GanjoorCategories.Where(c => c.Id == parent.ParentId).FirstOrDefaultAsync();
parent = parent.Parent;
}
}
return new RServiceResult<GanjoorPoetCompleteViewModel>
(
new GanjoorPoetCompleteViewModel()