// GET api/<controller>/5 public BillDestination Get(Guid id) { BillDestination destination = new BillDestination(); destination.Id = id; destination.LoadById(); return(destination); }
public void DeleteTest() { BillDestinationList billdestinations = new BillDestinationList(); billdestinations.Load(); BillDestination billdestination = billdestinations.FirstOrDefault(c => c.BusinessName == "Updated BillDestination"); int actual = billdestination.Delete(); Assert.IsTrue(actual > 0); }
public void InsertTest() { BillDestination newpayment = new BillDestination(); newpayment.Id = Guid.NewGuid(); newpayment.BusinessName = "New BillDestination"; newpayment.BusinessAddress = "New BillDestination"; int actual = newpayment.Insert(); Assert.IsTrue(actual > 0); }
public void UpdateTest() { BillDestinationList billdestinations = new BillDestinationList(); billdestinations.Load(); BillDestination billdestination = billdestinations.FirstOrDefault(c => c.BusinessName == "New BillDestination"); billdestination.BusinessName = "Updated BillDestination"; billdestination.Update(); billdestination.LoadById(); Assert.AreEqual(billdestination.BusinessName, "Updated BillDestination"); }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { BillDestination destination = new BillDestination(); destination.Id = Guid.NewGuid(); destination.BusinessName = txtName.Text; destination.BusinessAddress = txtAddress.Text; BillDestinationList destinations = new BillDestinationList(); HttpClient client = InitializeClient(); string serializedDestination = JsonConvert.SerializeObject(destination); var content = new StringContent(serializedDestination); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage response = client.PostAsync("BillDestination", content).Result; destinations.Add(destination); lblLog.Content = "Destination Added"; }
// PUT api/<controller>/5 public void Put(Guid id, [FromBody] BillDestination destination) { destination.Update(); }
// POST api/<controller> public void Post([FromBody] BillDestination destination) { destination.Insert(); }