コード例 #1
0
        public ActionResult Admin(int employeeid)
        {
            List <TechniqueViewModel> Techniqueviewmodellist = new List <TechniqueViewModel>();
            List <Technique>          employeetechlist       = TechniqueService.GetByEmployee(employeeid);

            using var context = new SqlLiteContext();
            List <Technique> techlist = context.Techniques.ToList();

            foreach (Technique t in techlist)
            {
                TechniqueViewModel tvm = new TechniqueViewModel();
                tvm.TechniqueId = t.TechniqueId;
                tvm.EmployeeId  = employeeid;
                tvm.Name        = t.Name;
                tvm.Connected   = false;
                foreach (Technique te in employeetechlist)
                {
                    if (t.TechniqueId == te.TechniqueId)
                    {
                        tvm.Connected = true;
                    }
                }
                Techniqueviewmodellist.Add(tvm);
            }
            var sortedlist = Techniqueviewmodellist.OrderBy(foo => foo.Name).ToList();
            var arv        = new BindEmployeeTechniqueViewModel(sortedlist);

            return(View(arv));
        }
コード例 #2
0
ファイル: Technique.cs プロジェクト: bassen82/DevsterCv
        public List <TechniqueViewModel> GetTechniqueView(int employee)
        {
            List <TechniqueViewModel> TechniqueViewModels = new List <TechniqueViewModel>();

            List <Technique> targetData = TechniqueService.GetByEmployee(employee);

            if (targetData == null)
            {
                return(TechniqueViewModels);
            }
            foreach (Technique target in targetData)
            {
                TechniqueViewModel evm = new TechniqueViewModel
                {
                    TechniqueId = target.TechniqueId,
                    Name        = target.Name
                };

                TechniqueViewModels.Add(evm);
            }
            return(TechniqueViewModels);
        }