Пример #1
0
        public async Task <JsonResult <HAQDetails> > InsertHAQDetailsList(List <HAQDetails> mApps)
        {
            HAQDetailsRepository mRepo = new HAQDetailsRepository(HAQDetailsRepository.DEFAULT_TABLE_NAME, HAQDetailsRepository.DEFAULT_PART_KEY);
            HAQDetails           haqDetails;

            char[]     delim     = { ',' };
            HAQDetails temp      = new HAQDetails();
            string     unique_id = "_" + DateTime.Now.Ticks.ToString();

            foreach (HAQDetails mApp in mApps)
            {
                if (mApp.Name != null && mApp.HATopic != null)
                {
                    haqDetails = new HAQDetails(mApp.Name + unique_id, mApp.HATopic, mApp.Result);
                    if (mApp.roles != null)
                    {
                        haqDetails.roles        = mApp.roles;
                        haqDetails.AllowedRoles = mApp.roles.Split(delim);
                    }
                    mRepo.InsertHAQDetails(haqDetails);
                    temp = haqDetails;
                }
            }

            return(Json <HAQDetails>(temp));
        }
Пример #2
0
        public async Task <JsonResult <HAQDetails> > InsertHAQDetails(HAQDetails mApp)
        {
            HAQDetailsRepository mRepo = new HAQDetailsRepository(HAQDetailsRepository.DEFAULT_TABLE_NAME, HAQDetailsRepository.DEFAULT_PART_KEY);
            HAQDetails           haqDetails;

            char[] delim = { ',' };
            if (mApp.Name != null && mApp.HATopic != null)
            {
                haqDetails = new HAQDetails(mApp.Name, mApp.HATopic, mApp.Result);
                if (mApp.roles != null)
                {
                    haqDetails.roles        = mApp.roles;
                    haqDetails.AllowedRoles = mApp.roles.Split(delim);
                }
                mRepo.InsertHAQDetails(haqDetails);
                mApp = haqDetails;
            }

            return(Json <HAQDetails>(mApp));
        }