I have the following method in the Controller and I pass JsonResult to another class (Receiver.cs) in C#. So, what is the proper data type as parameter in Receiver.cs class? I used JsonResult but not sure if it is the best option for this situation? I also return this result from Receiver.cs class to client as Json object.
Controller:
public void Create() {
//code omitted for brevity
var data = GetData();
var data = Json(new { Data = data, success = true }, JsonRequestBehavior.AllowGet);
Receiver.BroadcastData(data);
}
Here is the method in Receiver.cs:
Receiver.cs:
public class Receiver
{
public static void BroadcastData(JsonResult data)
{
...
}
}
Update: Actually I use ASP.NET MVC and SignalR. Here I want to pass Json object from Controller to Hub class. After then, I will broadcast this Json object to the client.