public async Task <IActionResult> Target(string id) { try { if (string.IsNullOrWhiteSpace(id) || !Guid.TryParse(id, out _)) { return(RedirectToAction("index")); } var target = await _targetService.GetTargetAsync(id, User); var updateTargetBindingModel = new UpdateTargetBindingModel { Id = target.Id, MonitoringInterval = target.MonitoringInterval, Name = target.Name, Url = target.Url }; return(View(updateTargetBindingModel)); } catch (Exception ex) { _logger.LogError(ex, "Exception occurred in Dashboard-Target GET action."); return(RedirectToAction("Exception", "Error")); } }
public async Task <IActionResult> Card(int id) { var isAuthResult = await _targetService.CheckAuthorization(id, UserId); if (!isAuthResult.Success) { AddModelErrors(isAuthResult); return(View(nameof(Index))); } var serviceResult = await _targetService.GetTargetAsync(id); if (!serviceResult.Success) { AddModelErrors(serviceResult); return(RedirectToAction(nameof(Index))); } return(View(serviceResult.Result)); }