public async Task <IActionResult> EditKnowledgeBase(int id) { var knowledgeBase = await _knowledgeBaseApiClient.GetKnowledgeBaseDetail(id); await SetCategoriesViewBag(); return(View(new KnowledgeBaseCreateRequest() { CategoryId = knowledgeBase.CategoryId, Description = knowledgeBase.Description, Environment = knowledgeBase.Environment, ErrorMessage = knowledgeBase.ErrorMessage, Labels = knowledgeBase.Labels, Note = knowledgeBase.Note, Problem = knowledgeBase.Problem, StepToReproduce = knowledgeBase.StepToReproduce, Title = knowledgeBase.Title, Workaround = knowledgeBase.Workaround, Id = knowledgeBase.Id })); }
public async Task <IActionResult> Details(int id) { var knowledgeBase = await _knowledgeBaseApiClient.GetKnowledgeBaseDetail(id); var category = await _categoryApiClient.GetCategoryById(knowledgeBase.CategoryId); var labels = await _knowledgeBaseApiClient.GetLabelsByKnowledgeBaseId(id); var viewModel = new KnowledgeBaseDetailViewModel() { Detail = knowledgeBase, Category = category, Labels = labels }; if (User.Identity.IsAuthenticated) { viewModel.CurrentUser = await _userApiClient.GetById(User.GetUserId()); } await _knowledgeBaseApiClient.UpdateViewCount(id); return(View(viewModel)); }