private async static Task <StandardResponse> GetResponse(GoodsRequest goodsRequest)
        {
            await LongTaskSim.WaitFive();

            var resp = new StandardResponse()
            {
                process_message = "Success"
            };

            if (goodsRequest.op_type == "create")
            {
                resp.status    = "inserted";
                resp.reference = Guid.NewGuid().ToString().ToString().Replace("-", "");
            }
            else if (goodsRequest.op_type == "update" || goodsRequest.op_type == "submit")
            {
                resp.status    = "updated";
                resp.reference = goodsRequest.goods_ref_number;
            }
            else if (goodsRequest.op_type == "delete")
            {
                resp.status    = "deleted";
                resp.reference = goodsRequest.goods_ref_number;
            }

            return(resp);
        }
        /*function is to simulate creating the response message
         * which would normaly be generated with data from database service;
         */
        private async static Task <StandardResponse> GetResponse(HeaderRequest header)
        {
            await LongTaskSim.WaitFive();

            var resp = new StandardResponse()
            {
                process_message = "SUCCESS"
            };

            if (header.op_type == "create")
            {
                var random = new Random(1000);
                var num    = random.Next(9000);

                resp.status    = "inserted";
                resp.reference = $"ENS00000000000{num}";
            }
            else if (header.op_type == "update" || header.op_type == "cancel")
            {
                resp.status    = "updated";
                resp.reference = header.declaration_number;
            }

            return(resp);
        }
예제 #3
0
        public async Task <IActionResult> Lookup([FromHeader] SD_LookupResponse lookupResponse)
        {
            if (lookupResponse == null)
            {
                return(BadRequest());
            }
            lookupResponse.sup_dec_number = "DEC000000000005499";
            await LongTaskSim.WaitFive();

            return(Ok(lookupResponse));
        }
예제 #4
0
        public async Task <IActionResult> SDUpdate(SDRequest sDRequest)
        {
            if (sDRequest == null)
            {
                return(BadRequest());
            }
            await LongTaskSim.WaitFive();

            var result = new StandardResponse()
            {
                status          = "updated",
                reference       = sDRequest.supp_dec_number,
                process_message = "Success"
            };

            return(Ok(result));
        }
		private async static Task<StandardResponse> GetResponse(ConsignmentRequest consignmentRequest)
		{
			await LongTaskSim.WaitFive();
			var resp = new StandardResponse() { process_message = "Success" };
			if (consignmentRequest.op_type == "create")
			{
				var random = new Random(1000);
				var num = random.Next(9000);

				resp.status = "inserted";
				resp.reference = $"DEC00000000000{num}";
			}
			else if (consignmentRequest.op_type == "update" || consignmentRequest.op_type == "cancel" || consignmentRequest.op_type == "submit")
			{
				resp.status = "updated";
				resp.reference = consignmentRequest.consignment_number;
			}

			return resp;
		}