I want to call a method inside some method and do not want the process to wait or take time on other method completion.
like this
public ActionResult Insert(int userId)
{
_userService.Insert(userId);
SyncUserInSomeOtherCollection(userId);
return new EmptyResult();
}
private SyncUserInSomeOtherCollection(int userId)
{
//Do Sync work which will actually take some time
}
I want to make SyncUserInSomeOtherCollection() work in such a way so that the main method return result without any wait.
I tried to run a task like this
Task.Run(async () => await SyncUserInSomeOtherCollection(userId)).Result;
But not sure if this a good approach to follow.