예제 #1
0
 private IEnumerable <TResult> HandleByComponent(MonitorRequest request)
 {
     foreach (var component in request.Components)
     {
         yield return(GetMonitorResult(component));
     }
 }
예제 #2
0
        private IHttpActionResult Handle(MonitorRequest request)
        {
            var results = request.Components.IsNullOrEmpty()
                    ? HandleOverallSystem(request)
                    : HandleByComponent(request);

            return(Ok(new MonitorResponse <TResult>(results.ToList())));
        }
예제 #3
0
 private IEnumerable <TResult> HandleOverallSystem(MonitorRequest request)
 {
     foreach (var monitorService in _monitorServices)
     {
         yield return(GetMonitorResult(
                          GetComponent(monitorService), monitorService));
     }
 }
예제 #4
0
        public IHttpActionResult Monitor([FromUri] MonitorRequest request)
        {
            try
            {
                Validate(request);

                return(Handle(request));
            }
            catch (Exception e)
            {
                return(HandleException(e));
            }
        }
예제 #5
0
 /// <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);
 }