public Child AddChild(Area Area, User user, string Name, string BirthDate) { var birthDate = DateTime.Parse(BirthDate); var child = new User() { LoginName = string.Format("{0}/{1}", user.ID, Name), UserName = Name, Password = birthDate.ToShortDateString(), BirthDate = birthDate, ProviderUserKey = Guid.NewGuid() }; middleManagement.User.Add(child); // Add user roles child = userManagement.ConfirmRegistration(child.ProviderUserKey.Value, false).Entity; var area = new Area() { ParentArea = Area, Name = "Transactions", Description = "Transactions", DescriptionRaw = "Transactions", // Copying permissions from parent // TODO: Might want to do something different here? AreaRoleAdmin = Area.AreaRoleAdmin, AreaRoleView = Area.AreaRoleView, CommentRoleView = Area.CommentRoleView, CommentRoleCreate = Area.CommentRoleCreate, CommentRoleDelete = Area.CommentRoleDelete, CommentRoleModerate = Area.CommentRoleModerate, PostRoleView = Area.PostRoleView, PostRoleCreate = Area.PostRoleCreate, PostRoleDelete = Area.PostRoleDelete, PostRoleModerate = Area.PostRoleModerate, }; middleManagement.Area.Add(area); var parentChild = new Child() { Parent = user, UserAccount = child, TransactionArea = area }; childRepository.Save(parentChild); return parentChild; }
public void AddMoney(Child ParentChild, decimal Amount) { var user = userSession.GetCurrent(); var transaction = new Transaction() { Area = ParentChild.TransactionArea, User = user, Amount = Amount, Title = "Transaction", Raw = new PostRaw() { Body = "" } }; transaction.Detail.Transaction = transaction; transactionRepository.AddTransaction(transaction); }