public void CreatePurchaseOrder() { var ord = new PurchaseOrderCreationdDto() { Id = "1", ItemName = "Jacket", ItemQuantity = "10", ItemDescription = "test", Status = "test2" }; string stringData = JsonConvert.SerializeObject(ord); var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync("/api/PurchaseOrder", contentData).Result; Assert.That("OK", Is.EqualTo(response.StatusCode.ToString())); }
public bool SaveOrder(PurchaseOrderCreationdDto order, IDictionary <string, string> collKeys) { queueClient = new QueueClient(collKeys["ConnectionString"], collKeys["Queue"], ReceiveMode.PeekLock, null); try { var json = JsonConvert.SerializeObject(order); queueClient.SendAsync(new Message(Encoding.UTF8.GetBytes(json))); return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
public IActionResult CreatePurchaseOrder([FromBody] PurchaseOrderCreationdDto pOrder) { if (pOrder == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } order = Factory.CreateInstance("sborder"); // order = Factory.CreateInstance("blobstorage"); // order = Factory.CreateInstance("defaultStorage"); Boolean result = order.SaveOrder(pOrder, KeyColl); return(Ok()); }
public bool SaveOrder(PurchaseOrderCreationdDto vOrder, IDictionary <string, string> collKeys) { throw new NotImplementedException(); }