Exemple #1
0
        public tblM_MappingRoleToRoleGroup Insert(MappingRoleToRoleGroupDTO mappingRoleToRoleGroupDTO, DateTime dateStamp)
        {
            if (mappingRoleToRoleGroupDTO == null)
            {
                throw new ArgumentNullException("MappingRoleToRoleGroup model is null.");
            }
            tblM_MappingRoleToRoleGroup mappingRoleToRoleGroup = mappingRoleToRoleGroupFactory.CreateFromDTO(mappingRoleToRoleGroupDTO, dateStamp);

            return(Db.tblM_MappingRoleToRoleGroup.Add(mappingRoleToRoleGroup));
        }
        public void Insert(RoleMapping mappingRole, DateTime dateStamp)
        {
            if (mappingRole == null)
            {
                throw new ArgumentNullException("MappingRoleToRoleGroup model is null.");
            }

            Delete(mappingRole.RoleGroup_PK);
            Db.SaveChanges();

            foreach (var mappingRoleToRoleGroupDTO in mappingRole.MappingRoleToRoleGroups)
            {
                mappingRoleToRoleGroupDTO.RoleGroup_PK = mappingRole.RoleGroup_PK;
                if (mappingRoleToRoleGroupDTO.IsChecked)
                {
                    tblM_MappingRoleToRoleGroup mappingRoleToRoleGroup = mappingRoleToRoleGroupFactory.CreateFromDTO(mappingRoleToRoleGroupDTO, dateStamp);
                    Db.tblM_MappingRoleToRoleGroup.Add(mappingRoleToRoleGroup);
                }
            }
        }