how display data into mvc using url(domain url) instead of xml document

Posted by Cpatil1000 under ASP.NET MVC on 9/21/2017 | Points: 10 | Views : 321 | Status : [Member] | Replies : 0
Hi,
I am new in MVC, Now our company has decide to develop new software in MVC.
So our client will give us api url and we want insert into data into database. I have found some coding how display data, but that coding using xml format data. I want use api url instead of xlm document. my api url is "http:/10.25.26.12/api/customer/details"

public List<Customer> GetAllCustomers()
{
List<Customer> customers = new List<Customer>();

XDocument doc = XDocument.Load("D:\\MvcWebAPI\\MvcWebAPI\\Customers.xml");

foreach (XElement element in doc.Descendants("DocumentElement")
.Descendants("Customer"))
{
Customer customer = new Customer();

customer.CustomerID = element.Element("CustomerID").Value;
customer.CompanyName = element.Element("CompanyName").Value;
customer.City = element.Element("City").Value;

customers.Add(customer);
}

return customers;
}




Responses

(No response found.)

Login to post response