コード例 #1
0
 public OperationResult Calculate(OperationRequest request)
 {
     try
     {
         var result = _service.Calculate(request);
         return(result);
     }
     catch (Exception ex)
     {
         throw new HttpResponseException(HttpStatusCode.BadRequest);
     }
 }
コード例 #2
0
        public IHttpActionResult PostSum([FromUri] string sum)
        {
            try
            {
                var log = new Log(FindIPAddress());
                _logService.Add(log);

                var result = _calcService.Calculate(sum);
                return(Ok(result));
            }
            catch (Exception)
            {
                return(BadRequest("Error In Calculation"));
            }
        }
コード例 #3
0
        public async Task HandleAsync(IMessage message)
        {
            var batchTelemetry = message as BatchTelemetry;

            if (batchTelemetry != null)
            {
                var aggregations = await calcService.Calculate(batchTelemetry);

                foreach (var calcData in aggregations)
                {
                    // todo: bulk publish?
                    eventBus.Publish(EventTopic.CalcData, calcData);
                }
            }
        }
コード例 #4
0
ファイル: CalcPresenter.cs プロジェクト: e-semenyuk/Calc
 public void Calculate(double[] values, double value, string operation)
 {
     _service.Calculate(values, value, operation);
     _service.ConvertToString();
 }