public async Task <IActionResult> Index(int Id)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var DefaultLanguageID = CurrentUser.DefaultLanguageId;

            var UICustomizationArray = new UICustomization(_context);

            ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID);

            Menus a = new Menus(_context);

            ViewBag.menuItems = await a.TopMenu(DefaultLanguageID);


            var ProcessTemplateStep = (from c in  _processTemplateStep.GetAllProcessTemplateSteps()
                                       join l in _processTemplateStepLanguage.GetAllProcessTemplateStepLanguages()
                                       on c.Id equals l.StepId
                                       where c.ProcessTemplateId == Id &&
                                       l.LanguageId == CurrentUser.DefaultLanguageId
                                       orderby l.Name
                                       select new SuObjectVM
            {
                Id = c.Id
                ,
                Name = l.Name
                ,
                ObjectId = c.ProcessTemplateId
            }).ToList();

            ViewBag.ObjectId = Id.ToString();


            return(View(ProcessTemplateStep));
        }
        public async Task <IActionResult> Edit(int Id)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var DefaultLanguageID = CurrentUser.DefaultLanguageId;

            var UICustomizationArray = new UICustomization(_context);

            ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID);

            Menus a = new Menus(_context);

            ViewBag.menuItems = await a.TopMenu(DefaultLanguageID);

            var Flow = (from f in _processTemplateFlow.GetAllProcessTemplateFlows()
                        join l in _processTemplateFlowLanguage.GetAllProcessTemplateFlowLanguages()
                        on f.Id equals l.FlowId
                        where f.Id == Id && l.LanguageId == CurrentUser.DefaultLanguageId
                        orderby l.Name
                        select new SuObjectVMPageSection
            {
                Id = f.ProcessTemplateId
                ,
                ObjectId = f.Id
                ,
                LanguageId = l.LanguageId
                ,
                ObjectLanguageId = l.Id
                ,
                Name = l.Name
                ,
                Description = l.Description
                ,
                MouseOver = l.MouseOver
                ,
                NotNullId = f.ProcessTemplateFromStepId
                ,
                NotNullId2 = f.ProcessTemplateToStepId
            }).First();

            //Existing levels
            List <SelectListItem> StepList = (from s in _processTemplateStep.GetAllProcessTemplateSteps()
                                              join l in _processTemplateStepLanguage.GetAllProcessTemplateStepLanguages()
                                              on s.Id equals l.StepId
                                              where l.LanguageId == CurrentUser.DefaultLanguageId &&
                                              s.ProcessTemplateId == Flow.Id
                                              orderby l.Name
                                              select new SelectListItem
            {
                Value = s.Id.ToString()
                ,
                Text = l.Name
            }).ToList();



            StepList.Add(new SelectListItem {
                Text = "No selection", Value = "0"
            });


            var ClassificationAndStatus = new PageSectionAndStatusViewModel {
                SuObject = Flow, SomeKindINumSelectListItem = StepList
            };

            return(View(ClassificationAndStatus));
        }