예제 #1
0
        public static NegAttributeUserBridge createNegAttributeRecord(/*int id, */ string userId, int attributeId)
        {
            NegAttributeUserBridge tempItem = new NegAttributeUserBridge()
            {
                //Id = id,
                UserId      = userId,
                AttributeId = attributeId
            };

            return(tempItem);
        }
예제 #2
0
        public IActionResult AttributeSet(AttributeSetViewModel vm)
        {
            /**************************** Code Segment 1 - Entering data into AttributeUserBridge table *****************/

            // Count of positive attributes selected
            int bridgeCount = (vm.PosAttribute).Count;

            AttributeUserBridge[] attrUserBridge = new AttributeUserBridge[bridgeCount];
            int[] attributeIds = new int[bridgeCount];
            attributeIds = (vm.PosAttribute).ToArray();

            for (int a = 0; a < ((vm.PosAttribute).Count); a++)
            {
                attrUserBridge[a] = UserScreeningSupport.createAttributeRecord(_userId, attributeIds[a]);
                _context.Add(attrUserBridge[a]);
            }

            _context.SaveChanges();

            /** Code Segment 1 End **/

            /***************************  Code Segment 2 - Entering data for  NegAttributeUserBridge Table  ****************************/

            // Count of negative attributes selected
            int nbridgeCount = (vm.NegAttribute).Count;

            NegAttributeUserBridge[] negAttriUserBridge = new NegAttributeUserBridge[nbridgeCount];
            int[] negAttributeIds = new int[nbridgeCount];
            negAttributeIds = (vm.NegAttribute).ToArray();

            for (int i = 0; i < ((vm.NegAttribute).Count); i++)
            {
                negAttriUserBridge[i] = UserScreeningSupport.createNegAttributeRecord(_userId, negAttributeIds[i]);
                _context.Add(negAttriUserBridge[i]);
            }
            _context.SaveChanges();

            /** Code Segment 2 End **/

            return(View());
        }