コード例 #1
0
        public void RegisterLegalPerson(LegalPersonDataContract legalPersonDataContract, string password)
        {
            var person = legalPersonDataContract.ToLegalPerson();

            LegalPersonBiz.Create(person);
            MembershipBiz.CreateMembershipForPerson(person, password);
            _context.SaveChanges();
        }
コード例 #2
0
        public void RegisterNaturalPerson(NaturalPersonDataContract naturalPersonDataContract, string password, string[] userRoles)
        {
            // Create User
            var person = NaturalPersonBiz.Create(naturalPersonDataContract.ToNaturalPerson());

            MembershipBiz.CreateMembershipForPerson(person, password);

            // Assign Roles
            if (userRoles.Count() > 0)
            {
                RoleBiz
                .Where(role => userRoles.Contains(role.Name))
                .ToList()
                .ForEach(role => person.Roles.Add(role));
            }

            //
            _context.SaveChanges();
        }