private void DeleteChannelRequestHandler(NetworkClient client, Message message) { var channelFromRequest = message.GetData <Channel>(); if (channelFromRequest.Id == LobbyChannelId) { Console.WriteLine("Cannot delete designated lobby channel id " + LobbyChannelId); return; } var channelFromServer = channelSessions.FirstOrDefault(c => c.Channel.Id == channelFromRequest.Id); if (channelFromServer == null) { Console.WriteLine("Unable to find channel id {0} in server", channelFromRequest.Id); return; } channelService.DeleteChannel(channelFromServer.Channel.Id); foreach (var userSession in channelFromServer.UserSessions) { AddUserToChannel(userSession, 0); } channelSessions.Remove(channelFromServer); BroadcastAll(client, Message.Create(MessageType.GetAllChannelsResponse, channelSessions), true); }
private void RemoveUserFromDatabase(User user) { var channel = _channelService.GetChannel(user.Login); _channelService.DeleteChannel(channel); client.SendMessage(TwitchInfo.BotName, $"Removed {user.Login} to the database."); }
public ActionResult DeleteChannel(int id) { if (Session["Userid"] == null) { return(RedirectToAction("Login", "User")); } channelService.DeleteChannel(id); return(RedirectToAction("MyChannel", "User")); }