Ejemplo n.º 1
0
        private D.Role ConverToDomain(EF.Role efRole)
        {
            D.Role role = new D.Role(efRole.Name);
            IEnumerable <string> permissions = efRole.Permissions.Split(';');

            foreach (var permission in permissions)
            {
                role.AddPermission(permission);
            }
            return(role);
        }
Ejemplo n.º 2
0
        private D.Account ConvertToDomain(EF.Account efAccount)
        {
            EF.Role              efRole        = _context.Roles.FirstOrDefault(r => r.RoleID == efAccount.RoleID);
            EF.AccountProfile    efProfile     = _context.Profiles.FirstOrDefault(r => r.ProfileID == efAccount.Profile.ProfileID);
            List <D.Beneficiary> beneficiaries = new List <D.Beneficiary>();

            foreach (var beneficiary in efProfile.Beneficiaries)
            {
                beneficiaries.Add(new D.Beneficiary(beneficiary.Name));
            }

            D.Role           role    = new D.Role(efRole.Name, efRole.Permissions);
            D.AccountProfile profile = new D.AccountProfile(efProfile.Name, beneficiaries);

            return(new D.Account(efAccount.UserName, efAccount.Password, efAccount.Salt, role, profile));
        }
Ejemplo n.º 3
0
 public void Add(D.Role role)
 {
     EF.Role efRole = new EF.Role(role.Name, String.Join(";", role.Permissions));
     _context.Roles.Add(efRole);
 }