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); }
public ActionResult CreateAccount(AccountViewModel acct, string userName, string email, string password, string confirmPassword) { if (!ModelState.IsValid) { return View(acct); } var dbAcct = new Account { Name = acct.Name, SubdomainName = acct.Subdomain, Plan = ModRepository.GetPlanByName("Unlimited") }; if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { var user = Membership.GetUser() as UACUser; var imgInfo = user.SaveImage(Request.Files[0]); dbAcct.Logo = imgInfo.FullRelativePath; } if (!CreateNewUser(userName, email, password, confirmPassword)) { return View(acct); } var createdUser = ModRepository.GetUserByName(userName); dbAcct.Users.Add(createdUser); ModRepository.AddAccount(dbAcct); ModRepository.Save(); TempData["Message"] = "Conta criada com sucesso!"; return RedirectToAction("ListAccounts"); }
/// <summary> /// Create a new Account object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="subdomainName">Initial value of the SubdomainName property.</param> public static Account CreateAccount(global::System.Int32 id, global::System.String name, global::System.String subdomainName) { Account account = new Account(); account.Id = id; account.Name = name; account.SubdomainName = subdomainName; return account; }
/// <summary> /// Deprecated Method for adding a new object to the Account EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAccount(Account account) { base.AddObject("Account", account); }
public void AddAccount(Account acct) { db.AddToAccount(acct); }
public void AddAccount(Account a) { throw new NotImplementedException(); }