Please consider this action method:
[HttpPost]
public async Task RemoveUserFromGroups(string connectionId, List<string> groupNames, string pusherAddress)
{
var onlineUser = OnlineUser.Instance;
await OnlineBusiness.RemoveUserFromGroups(onlineUser.Id, onlineUser.CustomerId, onlineUser.IsTrader, connectionId, groupNames, pusherAddress);
}
and this method:
public static Task<bool> RemoveUserFromGroups(int userId, int customerId, bool isTrader, string connectionId, List<string> groupNames, string pusherAddress)
{
return Task.FromResult(PusherBusiness.RemoveUserFromGroups(userId, customerId, isTrader, connectionId, groupNames, pusherAddress));
}
The PusherBusiness class in a third party library that in the class call a web service.
I want to change my controller to async mode.is this correct to use Task.FromResult and return Task and then await on it?
Is this async?