Пример #1
0
        // GET api/<controller>/5
        public BillDestination Get(Guid id)
        {
            BillDestination destination = new BillDestination();

            destination.Id = id;
            destination.LoadById();
            return(destination);
        }
Пример #2
0
        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);
        }
Пример #3
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);
        }
Пример #4
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");
        }
Пример #5
0
        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";
        }
Пример #6
0
 // PUT api/<controller>/5
 public void Put(Guid id, [FromBody] BillDestination destination)
 {
     destination.Update();
 }
Пример #7
0
 // POST api/<controller>
 public void Post([FromBody] BillDestination destination)
 {
     destination.Insert();
 }