I have a web application, and in the DAL file I have some methods. The methods get results by calling an API. For example:
public string GetUserName(int userID)
{
HttpWebRequest GETRequest = (HttpWebRequest)WebRequest.Create(url);
GETRequest.Method = "GET";
HttpWebResponse GETResponse = (HttpWebResponse)GETRequest.GetResponse();
Stream GETResponseStream = GETResponse.GetResponseStream();
StreamReader srResponse = new StreamReader(GETResponseStream);
return srResponse.ReadToEnd();
}
My requirement is that I need to execute these methods via command the line and show the result. I do not understand how to do this; please suggest a way to proceed.
Well, you need to parse the command line arguments. Let’s say we define our command line format like this:
yourprogram.exe function_name paramValue, then we need to do the following:then, you would execute
yourprogram.exe GetUserName 5in the console.