Exemplo n.º 1
0
        public ActionResult Create(ProjectViewModel projectViewModel, SkillViewModel skillViewModel, String tags, String btn)
        {
            initDropList();
            FillEnumDropDownList();
            projectViewModel.totalNumberResource = 0;
            projectViewModel.levioNumberResource = 0;
            skill                 skillDomain = new skill();
            List <string>         listTags    = tags.Split(',').ToList();
            List <SkillViewModel> listSkills  = new List <SkillViewModel>();
            string                clientId    = Request.Form["CLIENT"].ToString();
            string                projectType = Request.Form["TypeProject"].ToString();



            projectViewModel.projectType = projectType;
            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://127.0.0.1:18080");
            if (btn != null && btn == "Next Step")
            {
                Client.PostAsJsonAsync <ProjectViewModel>(
                    "Map-JavaEE-web/MAP/projects?idClient=" + Int32.Parse(clientId), projectViewModel)
                .ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());

                foreach (var tag in listTags)
                {
                    skillViewModel.NameSkill = tag;
                    skillDomain.NameSkill    = skillViewModel.NameSkill;
                    skillService.Add(skillDomain);
                    skillService.Commit();
                    listSkills.Add(new SkillViewModel(skillDomain.IdSkill, skillDomain.NameSkill));
                }
                var i1 = db.projects.OrderByDescending(u => u.id).FirstOrDefault();

                return(RedirectToAction("Skills", new { serializedModel = JsonConvert.SerializeObject(listSkills), id = i1.id }));
            }

            return(View());
        }
Exemplo n.º 2
0
        public ActionResult DeleteSkill(int id, int SkillId)
        {
            Candidate c = candidateService.GetById(id);

            for (int i = 0; i < c.Skills.Count; i++)
            {
                if (c.Skills.ElementAt(i).SkillId == SkillId)
                {
                    c.Skills.Remove(c.Skills.ElementAt(i));
                    break;
                }
            }
            candidateService.Update(c);
            candidateService.Commit();
            Skill s = skillService.GetById(SkillId);

            skillService.Delete(s);
            skillService.Commit();
            return(RedirectToAction("Details", new { id }));
        }
Exemplo n.º 3
0
 // GET: Skill/Delete/5
 public ActionResult Delete(int id)
 {
     skillService.Delete(s => s.skillId == id);
     skillService.Commit();
     return(RedirectToAction("Index"));
 }