public async Task Delete(string userName) { IChannelDirectoryService channelDirectoryService = ServiceProxy.Create <IChannelDirectoryService>( new Uri("fabric:/TwitchSf/ChannelDirectoryService"), ServicePartitionKey.Singleton, targetReplicaSelector: TargetReplicaSelector.RandomReplica); await channelDirectoryService.RemoveChannelByName(userName); }
public async Task <IEnumerable <TwitchChannel> > Get() { IChannelDirectoryService channelDirectoryService = ServiceProxy.Create <IChannelDirectoryService>( new Uri("fabric:/TwitchSf/ChannelDirectoryService"), ServicePartitionKey.Singleton, targetReplicaSelector: TargetReplicaSelector.RandomReplica); return(await channelDirectoryService.GetChannelsAsync()); }
public async Task <IActionResult> Post(string userName) { IChannelDirectoryService channelDirectoryService = ServiceProxy.Create <IChannelDirectoryService>( new Uri("fabric:/TwitchSf/ChannelDirectoryService"), ServicePartitionKey.Singleton, targetReplicaSelector: TargetReplicaSelector.RandomReplica); try { var channel = await channelDirectoryService.AddChannelByNameAsync(userName); return(Created("???", channel)); } catch (AddChannelFailedException e) when(e.Reason == AddChannelFailedReason.ChannelNotFound) { return(NotFound()); } }