I think this tutorial will do what you are looking for
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
with web apis you have a few options. the above sample is a simple way of doing it.
you can also use Angular JS or knockoutjs or my favorite one is using breeze js.
Adding more information about how to connect model to the web service
in the above example, in thr Adding a model section:
Class product is being created :
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public string Category { get; set; }
public decimal Price { get; set; }
}
this class is the blue print of our model
we fill this model in the Controller ( Controller is responsible for managing our model and introduce it to the view)
So product class being filled here
Product[] products = new Product[]
{
new Product { Id = 1, Name = "Tomato Soup", Category = "Groceries", Price = 1 },
new Product { Id = 2, Name = "Yo-yo", Category = "Toys", Price = 3.75M },
new Product { Id = 3, Name = "Hammer", Category = "Hardware", Price = 16.99M }
};
The main point is our controller should be inherited from ApiController.
public IEnumerable<Product> GetAllProducts()
{
return products;
}
public IHttpActionResult GetProduct(int id)
{
var product = products.FirstOrDefault((p) => p.Id == id);
if (product == null)
{
return NotFound();
}
return Ok(product);
}
The above two methods are getting data from our model and returning data.
and at the end our javascript file is responsible for reading the data by using $.getJSON .
so to answer your question. how connecting model to web services. the answer is in the methods in controllers.
this is a very simple sample. in real-world data needs to be read from database with using entity framework
this sample shows how to do it
http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application