Technically your need is unclear and very much ambiguous. Why do you need to do that? How can you convert, an object to an array?
One simple way would be, to
accept the object, create an array, add that object to the array, and serialize the array. :D I mean, this is a very surreal sort of scenario, in which you would be needed to do this. There can be several ways where you might want to do this, such as, server or client might be looking for an array response. But nonetheless, this is not a good approach, you need to rethink your API protocol, verb and resource sharing.
Your code is showing a good example of doing this, I can see that you already have a list of your collection there in the
repo
object.
public List<Event> GetUpcomingEvents()
{
EventMasterDb repo = new EventMasterDb();
StringBuilder query = new StringBuilder();
var list = repo.Fetch<List<Event>>(query.ToString());
return list;
}
One more thing, the API do not require you to use MVC wrappers, such as ActionResults etc, you just need to return your own custom types, or containers (
List
etc). ASP.NET Web API will automatically map them to what you need in the JSON or XML format.