private IEnumerable <TResult> HandleByComponent(MonitorRequest request) { foreach (var component in request.Components) { yield return(GetMonitorResult(component)); } }
private IHttpActionResult Handle(MonitorRequest request) { var results = request.Components.IsNullOrEmpty() ? HandleOverallSystem(request) : HandleByComponent(request); return(Ok(new MonitorResponse <TResult>(results.ToList()))); }
private IEnumerable <TResult> HandleOverallSystem(MonitorRequest request) { foreach (var monitorService in _monitorServices) { yield return(GetMonitorResult( GetComponent(monitorService), monitorService)); } }
public IHttpActionResult Monitor([FromUri] MonitorRequest request) { try { Validate(request); return(Handle(request)); } catch (Exception e) { return(HandleException(e)); } }
/// <summary> /// Validates the request /// </summary> /// <param name="request">The request</param> /// <exception cref="ValidationException">If request is not valid</exception> protected virtual void Validate(MonitorRequest request) { GetValidator() .ThrowIf(request); }