Beispiel #1
0
        public void CreateNetworkFromProfile(IRCProfile profile)
        {
            var network = networks.Where(n => n.Id == profile.Id).FirstOrDefault();

            if (network == null)
            {
                network = new Network()
                {
                    Id       = profile.Id,
                    Name     = profile.Name,
                    Address  = profile.Servers,
                    Username = profile.Username
                };

                SetupNetwork(network);
                Connect(network);
            }
        }
        public void Set(IRCProfile profile)
        {
            Condition.Requires <string>(profile.Name, "Name").IsNotNullOrWhiteSpace();

            if (profile.Id == null)
            {
                profile.Id = idService.NewId();
            }
            else
            {
                var existing = Get(profile.Id);
                if (existing != null)
                {
                    profiles.Remove(existing);
                }
            }

            profiles.Add(profile);
            mediator.Publish(new AddProfileEvent()
            {
                Profile = profile
            });
            Save();
        }
Beispiel #3
0
 public IActionResult Put([FromBody] IRCProfile profile)
 {
     profileService.Set(profile);
     return(Ok());
 }