// 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()); } }
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); }
public IHttpActionResult Post([FromBody] OrderContract orderContract) { return(Ok(_orderBusiness.AddOrder(orderContract))); }
public async Task <IActionResult> Post([FromBody] OrderModel model) { return(Ok(await _orderBusiness.AddOrder(model))); }
public ContentResult AddOrder([FromBody] OrderInput orderInput) { return(order.AddOrder(orderInput)); }