コード例 #1
0
        [HttpPost] //Always explicitly state the accepted HTTP method
        public IHttpActionResult Mult([FromBody] RootMultRequest rootRequest)
        {
            ContextOperation context      = new ContextOperation();
            RootMultResponse rootResponse = new RootMultResponse()
            {
                Product = context.Multiply(rootRequest.Factors)
            };

            System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers;
            string XEviTrackingId = string.Empty;

            if (headers.Contains("XEviTrackingId"))
            {
                XEviTrackingId = headers.GetValues("XEviTrackingId").FirstOrDefault();

                OperationDTO operation = new OperationDTO()
                {
                    Calculation = String.Join(context.MultipleArgsOperationStrategy.OperatorCode, rootRequest.Factors) + "=" + rootResponse.Product,
                    Id          = XEviTrackingId,
                    Date        = DateTime.Now,
                    Operation   = context.MultipleArgsOperationStrategy.Name
                };

                this.journalDBOperations.PersistOperation(operation);
            }

            return(Ok(rootResponse));
        }
コード例 #2
0
 public void Test3() => Assert.AreEqual(60, context.Multiply(new System.Collections.Generic.List <double>()
 {
     2, 5, 6
 }));