Exemple #1
0
        public string SkillInfoInput()
        {
            if (session.IsAuthorised)
            {
                skillService.ShowSkills();

                string name   = string.Empty;
                int    points = 0;

                name = InfoUnit.GetInfoUnit(name,
                                            x => !string.IsNullOrEmpty(x.ToString()) && x.ToString().Length > 1,
                                            "Enter skill name",
                                            @"Error! Skill name is invalid!").ToString();

                points = Convert.ToInt32(InfoUnit.GetInfoUnit(points,
                                                              x => !string.IsNullOrEmpty(x.ToString()),
                                                              "Enter points",
                                                              @"Error! points is invalid!"));

                skillService.Add(name, points);
                return(name);
            }
            else
            {
                Console.WriteLine("You need to authorize");
                return(null);
            }
        }
Exemple #2
0
        public IActionResult Post([FromBody] Skill skill)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _skillService.Add(skill);

                    if (skill.Id > 0)
                    {
                        return(Ok(skill));
                    }
                    else
                    {
                        _logger.LogInfo("skill not saved");
                        return(BadRequest());
                    }
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex.Message);
                    return(BadRequest());
                }
            }

            return(BadRequest());
        }
Exemple #3
0
        public async Task <IActionResult> Add(SkillAddDto skillAddDto)
        {
            if (ModelState.IsValid)
            {
                await _skillService.Add(skillAddDto, "Hasan Erdal");

                return(RedirectToAction("Index"));
            }
            return(View());
        }
Exemple #4
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());
        }
Exemple #5
0
        public ActionResult Create([Bind(Include = "id,name")] skill skill)
        {
            if (ModelState.IsValid)
            {
                _skillService.Add(skill);
                _skillService.commit();

                return(RedirectToAction("Index"));
            }

            return(View(new SkillsViewDetailsModel()
            {
                User = CurrentUser, Skill = skill
            }));
        }
Exemple #6
0
 public IHttpActionResult Post(SkillDTO employee)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         Skill record = Mapper.Map <SkillDTO, Skill>(employee);
         skillService.Add(record);
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
     return(CreatedAtRoute("DefaultApi", new { id = employee.Id }, employee));
 }
Exemple #7
0
        public ActionResult Create(SkillFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.Categories = _categoryService.GetAll();
                return(View("SkillForm", viewModel));
            }

            var skill = new SkillDto
            {
                Name       = viewModel.Name,
                CategoryId = viewModel.CategoryId
            };

            _skillService.Add(skill);

            return(RedirectToAction("Skills", "Skills"));
        }
Exemple #8
0
 public IActionResult CadastrarSkill(CadastroSkillViewModel skill)
 {
     try
     {
         //busca o tipo da skill pelo id e verifica se ela é encontrada
         TiposSkills tipoSkillBuscada = _tipoSkillRepository.GetById(skill.FkTipoSkill);
         if (tipoSkillBuscada == null)
         {
             return(NotFound(new { Mensagem = $"Não foi possível encontrar o tipo de skill" }));
         }
         _mapperSkill.Add(skill);
         return(Ok(new { Mensagem = "Skill cadastrada com sucesso" }));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { Erro = ex.ToString() }));
     }
 }
Exemple #9
0
 public ActionResult AddSkill(SkillViewModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             skillService.Add(model.Name, model.Points);
             return(RedirectToAction("Index", "Home"));
         }
         catch (ArgumentException ex)
         {
             ViewBag.Error = ex.Message;
             return(View("Error"));
         }
     }
     else
     {
         ViewBag.Skills = skillService.Get();
         return(View(model));
     }
 }
Exemple #10
0
 public JsonResult storeAdd(Skill skill)
 {
     _skillService.Add(skill);
     return(Json("Başarıyla eklendi"));
 }
Exemple #11
0
 public IActionResult Add(Skill skill)
 {
     skillService.Add(skill);
     return(RedirectToAction("All"));
 }