コード例 #1
0
ファイル: DoverController.cs プロジェクト: felipecsl/dover
        protected override ViewResult View(string viewName, string masterName, object model)
        {
            if (TempData["Message"] != null) {
                ViewData["Message"] = TempData["Message"];
            }

            try {
                var repo = new ModuleRepository();
                var currAccountName = RouteData.Values["account"] as string;

                if (!String.IsNullOrWhiteSpace(currAccountName)) {
                    RouteData.Values.Add("accountFriendlyName", repo.GetAccountByName(currAccountName).Name);
                }
            }
            catch {
                // TODO: Do something about this
            }

            return base.View(viewName, masterName, model);
        }
コード例 #2
0
ファイル: AccountTests.cs プロジェクト: felipecsl/dover
        public void TestAddUserToAccount()
        {
            var conn = new EntityConnection(SerializationTests.ConnectionString);
            var repo = new ModuleRepository(conn);
            var account = new Account {
                Name = "DBServer",
                SubdomainName = "dbserver"
            };
            var user = repo.GetUserByName("dbserver");
            account.Users.Add(user);
            repo.AddAccount(account);
            repo.Save();

            var newAcct = repo.GetAccountByName("dbserver");

            Assert.IsNotNull(newAcct);

            var newUser = newAcct.Users.FirstOrDefault(u => u.UserId == user.UserId);

            Assert.IsNotNull(newUser);
        }
コード例 #3
0
ファイル: DoverController.cs プロジェクト: minhle5851/dover
        protected override ViewResult View(string viewName, string masterName, object model)
        {
            if (TempData["Message"] != null)
            {
                ViewData["Message"] = TempData["Message"];
            }

            try {
                var repo            = new ModuleRepository();
                var currAccountName = RouteData.Values["account"] as string;

                if (!String.IsNullOrWhiteSpace(currAccountName))
                {
                    RouteData.Values.Add("accountFriendlyName", repo.GetAccountByName(currAccountName).Name);
                }
            }
            catch {
                // TODO: Do something about this
            }

            return(base.View(viewName, masterName, model));
        }