0

Currently I am using a WebAPI to send Data to a local server XML is below

ArrayOfCasualty Casualty
BeaconID: A1 BeaconID
Latitude 51.41459808 Latitude
Longitude -5.43823242 Longitude
OwnerName Mr. Damola OwnerName
Pulse 200 Pulse
Casualty
ArrayOfCasualty

I can display this information, from another "location" using a WebRequest Is it possible to get this info to populate an SQL database?

using System;
using System.IO;
using System.Net;
using System.Text;

namespace WebApplication5
{
public class WebRequestGetExample
{
    public static void Main()
    {

        WebRequest request = WebRequest.Create(
          "http://localhost:5150/api/casualty");
        WebResponse response = request.GetResponse();

        Console.WriteLine(((HttpWebResponse)response).StatusDescription);

        Stream dataStream = response.GetResponseStream();

        StreamReader reader = new StreamReader(dataStream);

        string responseFromServer = reader.ReadToEnd();

        Console.WriteLine(responseFromServer);

        response.Close();
    }
}
Alexander
  • 3,129
  • 2
  • 19
  • 33
user001
  • 415
  • 1
  • 7
  • 22

1 Answers1

0

For something like this, I would recommend using Entity Framework.

http://www.asp.net/web-api/overview/creating-web-apis/using-web-api-with-entity-framework/using-web-api-with-entity-framework,-part-1

u84six
  • 4,604
  • 6
  • 38
  • 65