예제 #1
0
        // POST: api/Order
        public IHttpActionResult Post([FromBody] Order value)
        {
            var order = orderBusiness.AddOrder(value);

            if (order != null)
            {
                var response = new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new ObjectContent <IOrder>(order, new JsonMediaTypeFormatter()) //, Encoding.UTF8, "application/json")
                };
                return(Ok(response));
            }
            else
            {
                return(InternalServerError());
            }
        }
예제 #2
0
        public void TestAddOrderExpectTrue()
        {
            var order = new OrderInput()
            {
                OrderId    = Guid.NewGuid(),
                ProductId  = Guid.Parse("157771ae-67a0-46c8-8453-0eafcdf4006a"),
                CustomerId = Guid.Parse("a663a20c-4b0d-4e46-88b4-b6d9d932b7b5"),
                Quantity   = 20
            };

            var addProduct = orderService.AddOrder(order);
            var valConv    = JsonConvert.DeserializeObject(addProduct.Content.ToString());
            var _result    = valConv.ToString() == "Success" ? true : false;

            Assert.True(_result);
        }
예제 #3
0
 public IHttpActionResult Post([FromBody] OrderContract orderContract)
 {
     return(Ok(_orderBusiness.AddOrder(orderContract)));
 }
예제 #4
0
 public async Task <IActionResult> Post([FromBody] OrderModel model)
 {
     return(Ok(await _orderBusiness.AddOrder(model)));
 }
예제 #5
0
 public ContentResult AddOrder([FromBody] OrderInput orderInput)
 {
     return(order.AddOrder(orderInput));
 }