public IViewComponentResult Invoke(IncomingIdRequest request) { ViewData["ProjectId"] = request.ProjectId; ViewData["CategoryField"] = request.UserId; if (request.Id == 0) { ViewData["Modal"] = 1; return(View("/Views/Shared/Components/Documentation/DocumentationPageHandler/Default.cshtml")); } using (var context = new DocumentationContext(Context, Configuration)) { ViewData["PageData"] = context.GetDocumentationPage(request.Id); } ViewData["Modal"] = 0; return(View("/Views/Shared/Components/Documentation/DocumentationPageHandler/Default.cshtml")); }
public List <dynamic> GetProjectDocumentation([FromBody] IncomingIdRequest request) { var eResult = new List <dynamic>(); var result = new List <OutgoingChatItem>(); using (var context = new DocumentationContext(Context, Configuration)) { var getDocumentationidByKey = context.GetProjectIdByDocumentationKey(request.Phase); if (getDocumentationidByKey == 0) { dynamic errorModel = new System.Dynamic.ExpandoObject(); errorModel.Error = "Not authorized exception, please check your API key!"; eResult.Add(errorModel); return(eResult); } result = GetNavigation(request, context); result.ForEach(x => { dynamic cResult = new System.Dynamic.ExpandoObject(); var vResult = new List <dynamic>(); cResult.CategoryName = x.NodeText; cResult.ParentId = ""; x.NodeChild.ForEach(y => { var bResult = new System.Dynamic.ExpandoObject(); var getPage = context.GetDocumentationPage(y.InternalId); vResult.Add(bResult); }); cResult.PageContents = vResult; eResult.Add(cResult); }); } return(eResult); }