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); }
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); }
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)); }