public async Task <IActionResult> Item([FromRoute] string id, [FromHeader(Name = "X-IC-Request")] bool isIntercooler) { var user = await _service.FindUserAsync(id); if (user == null) { return(NotFound()); } if (isIntercooler) { return(View(user)); } var model = new UserViewModel { List = await _service.GetUsersAsync(), User = user }; return(View(nameof(List), model)); }
public async Task <IActionResult> Data([FromRoute] string collectionName, [FromRoute] string id) { var collection = await _settingsService.FindCollectionAsync(collectionName); if (collection == null) { return(NotFound()); } var item = await _dataService.LookupAsync(id); if (item == null) { return(NotFound()); } var model = new DataPreviewViewModel { Item = item, Collection = collection, ResolveUserNameAsync = async userId => (await _userManageService.FindUserAsync(userId))?.Name }; if (string.IsNullOrEmpty(collection.PreviewTemplate)) { return(View(model)); } var template = await _templateService.FindAsync(collection.PreviewTemplate); if (template == null) { return(View(model)); } var result = await _templateService.RenderAsync(collection.PreviewTemplate, model); return(Content(result, "text/html")); }