This is one of the sample Implementation and not the original code.. This question may be old one but would like to understand the basics.. Here the return type is specified as IEnumerable but actually we are returning a List here..
So if we are returning the List, then we can make the method return type also as List.. rit?
public IEnumerable<product> AddProducts(IEnumerable<Product> pList)
{
List<product> pNewProducts = new List <product>();
Product prod = new Product();
foreach (Product p in pList)
{
prod = Get(p.Id); // get item being updated
if (p.Equals(Add(p)))
pNewProducts.Add(p);
}
return pNewProducts; // return collection of added products
}
This is one of the sample method in WebAPI