コード例 #1
0
        // GET: SkillRessources
        public ActionResult Affect()
        {
            ServiceSkillRessource s         = new ServiceSkillRessource();
            ServiceResource       ressource = new ServiceResource();
            ServiceSkills         skill     = new ServiceSkills();


            var sr = s.GetMany();

            List <SkillRessourceViewModel> list = new List <SkillRessourceViewModel>();

            foreach (var item in sr)
            {
                SkillRessourceViewModel svm = new SkillRessourceViewModel();

                User rs = new User();
                rs = ressource.GetById(item.IdRessource);
                Skills sk = new Skills();
                sk = skill.GetById(item.IdSkill);
                string nomressource = rs.UserName;
                string nomskill     = sk.SkillName;
                float  skillrate    = item.SkillRate;
                svm.nomressource = nomressource;
                svm.nomskill     = nomskill;
                svm.SkillRate    = skillrate;
                //svm.IdRessource = item.IdRessource;
                // svm.IdSkill = item.IdSkill;
                svm.id = item.id;
                list.Add(svm);
            }
            return(View(list));
        }
コード例 #2
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            SkillRessource        sr = new SkillRessource();
            ServiceSkillRessource sk = new ServiceSkillRessource();

            sr = sk.GetById(id);
            sk.Delete(sr);
            sk.Commit();
            return(RedirectToAction("Affect"));
        }
コード例 #3
0
        public ActionResult Create(SkillRessourceViewModel srv)
        {
            ServiceSkillRessource s  = new ServiceSkillRessource();
            SkillRessource        sr = new SkillRessource();

            sr.IdRessource = srv.IdRessource;
            sr.IdSkill     = srv.IdSkill;
            // sr.SkillRate = srv.SkillRate;
            s.Add(sr);
            s.Commit();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public ActionResult Edit(int id, SkillRessourceViewModel svm)
        {
            SkillRessource        sr = new SkillRessource();
            ServiceSkillRessource sk = new ServiceSkillRessource();

            sr = sk.GetById(id);
            //   sk.SkillRate = svm.SkillRate;
            sr.SkillRate = svm.SkillRate;

            sk.Update(sr);
            sk.Commit();
            return(RedirectToAction("Affect"));
        }
コード例 #5
0
        public ActionResult CompleteProfile(int id, RessourceViewModel rvm)
        {
            Ressource r = new Ressource();
            // RessourceViewModel rvm = new RessourceViewModel();
            ServiceRessource      sr             = new ServiceRessource();
            Skills                s              = new Skills();
            ServiceSkills         ser            = new ServiceSkills();
            ServiceSkillRessource skillressource = new ServiceSkillRessource();
            SkillRessource        skr            = new SkillRessource();
            var           nomskill   = ser.GetMany();
            List <String> SkillsList = new List <string>();

            foreach (var item in nomskill)
            {
                SkillsList.Add(item.SkillName);
            }

            List <String> WType = (new List <String> {
                "IT", "HR", "Finance", "Administration"
            });
            List <String> CType = (new List <String> {
                "Employee", "Freelancer"
            });
            List <String> SType = (new List <String> {
                "Junior", "Senior"
            });
            var x = ser.Get(t => t.SkillName == rvm.Skill);

            ViewBag.list1   = WType;
            ViewBag.list2   = CType;
            ViewBag.list3   = SType;
            ViewBag.list4   = SkillsList;
            skr.SkillRate   = rvm.Note;
            skr.IdRessource = id;
            skr.IdSkill     = x.SkillId;
            r              = sr.GetById(id);
            r.WorkType     = (MapDomain.Entities.WorkType)rvm.WorkType;
            r.ContractType = (MapDomain.Entities.ContractType)rvm.ContractType;
            sr.Update(r);
            sr.Commit();
            skillressource.Add(skr);
            skillressource.Commit();
            return(RedirectToAction("AllResources"));
        }
コード例 #6
0
        // GET: SkillRessources/Edit/5
        public ActionResult Edit(int id)
        {
            SkillRessourceViewModel svm = new SkillRessourceViewModel();
            SkillRessource          sr  = new SkillRessource();
            ServiceSkillRessource   sk  = new ServiceSkillRessource();
            ServiceResource         serviceressource = new ServiceResource();
            ServiceSkills           serviceskill     = new ServiceSkills();

            sr = sk.GetById(id);
            int idr = sr.IdRessource;
            int ids = sr.IdSkill;
            var s   = serviceskill.GetById(ids);
            var r   = serviceressource.GetById(idr);

            svm.id           = sr.id;
            svm.SkillRate    = sr.SkillRate;
            svm.nomressource = r.UserName;
            svm.nomskill     = s.SkillName;

            return(View(svm));
        }