Esempio n. 1
0
        public void Setup()
        {
            var peterAccount = new Majorsilence.Vpn.Logic.Accounts.CreateAccount(
                new Majorsilence.Vpn.Logic.Accounts.CreateAccountInfo()
            {
                Email           = emailAddress,
                EmailConfirm    = emailAddress,
                Firstname       = "Bobby",
                Lastname        = "Smith",
                Password        = "******",
                PasswordConfirm = "Password54",
                BetaKey         = ""
            }
                , false, Majorsilence.Vpn.Logic.InitializeSettings.Email);

            this.userid = peterAccount.Execute();

            var region = new Majorsilence.Vpn.Logic.Admin.Regions();

            regionid = region.Insert("Test region", true);

            var vpnserver = new Majorsilence.Vpn.Logic.Admin.VpnServers();

            vpnseverid = vpnserver.Insert("localhost", 5678, "a fake vpnserver for testing", regionid, true);
        }
Esempio n. 2
0
        public ActionResult EditServers(int?id, string address, int port,
                                        string desc, int region, string active)
        {
            if (sessionInstance.LoggedIn == false || sessionInstance.IsAdmin == false)
            {
                return(null);
            }


            try
            {
                bool activeYes = false;
                if (active != null)
                {
                    activeYes = true;
                }

                var vpns = new Majorsilence.Vpn.Logic.Admin.VpnServers();
                if (id.HasValue)
                {
                    vpns.Update(id.Value, address,
                                port,
                                desc,
                                region,
                                activeYes);
                }
                else
                {
                    vpns.Insert(address,
                                port,
                                desc,
                                region,
                                activeYes);
                }
            }
            catch (Exception ex)
            {
                Majorsilence.Vpn.Logic.Helpers.Logging.Log(ex);
            }

            return(View(new Models.CustomViewLayout(sessionInstance)));
        }
Esempio n. 3
0
 public AdminVpnServers()
 {
     _vpnServersList = new Majorsilence.Vpn.Logic.Admin.VpnServers().Select();
 }