Пример #1
0
        /// <summary>
        /// 获取 spaceList
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="steps">案例步骤用于识别使用哪个框架</param>
        public static List <SelectListItem> spaceSelectList(this blockPlayDBContext _db, int userID, List <step> steps)
        {
            var list = _db.spaceSelectList(userID);

            //尝试获取默认的space
            var stp        = steps.FirstOrDefault(t => t.spaceID > 0);
            int defSpaceID = stp == null ? 0 : stp.spaceID;

            var selectItem = list.FirstOrDefault(t => t.Value == defSpaceID.ToString());

            if (selectItem != null)
            {
                selectItem.Selected = true;
            }

            return(list);
        }
Пример #2
0
        public IActionResult caseTab(int id)
        {
            var userID   = User.userID();
            var testCase = _context.TestCase.First(t => t.Id == id && t.UserId == userID);

            caseTabModel md = new caseTabModel();

            md.id   = testCase.Id;
            md.name = testCase.Name;
            var bd = testCase.bodyModel();

            md.steps = bd.steps;


            md.spaceSelect = _context.spaceSelectList(userID, bd.steps);

            return(View("caseTab", md));
        }
Пример #3
0
        public IActionResult editTab(int id)
        {
            var userID    = User.userID();
            var blockStep = _context.BlockStep.FirstOrDefault(t => t.Id == id);

            var model = new blockTabModel();

            model.id    = blockStep.Id;
            model.name  = blockStep.Name;
            model.steps = blockStep.blockSteps();


            model.spaceSelect = _context.spaceSelectList(userID, model.steps);

            var bloclSelect = model.spaceSelect.First(t => t.Value == "0");

            model.spaceSelect.Remove(bloclSelect);

            return(View("blockTab", model));
        }