private MaterialDTO BasicInfoInput()
        {
            string name   = string.Empty;
            string link   = string.Empty;
            string skills = string.Empty;

            name = InfoUnit.GetInfoUnit(name,
                                        x => !string.IsNullOrEmpty(x.ToString()) && x.ToString().Length > 1,
                                        "Enter material name",
                                        @"Error! Enter the material name!").ToString();

            link = InfoUnit.GetInfoUnit(link,
                                        x => !string.IsNullOrEmpty(x.ToString()) && Regex.IsMatch(x.ToString(), urlRegex, RegexOptions.IgnoreCase),
                                        "Enter material link!",
                                        @"Error! Enter the correct link!").ToString();

            skillService.ShowSkills();

            List <Skill> skillList = new List <Skill>();

            while (true)
            {
                string command = string.Empty;
                command = InfoUnit.GetInfoUnit(command,
                                               x => !string.IsNullOrEmpty(x.ToString()) && new List <string> {
                    "0", "1", "2"
                }.Contains(x.ToString()),
                                               "Wanna add new skill(1) or existing one(2) PRESS 0 TO EXIT SKILL ADDING MODE?",
                                               @"Error! Enter the correct command!").ToString();

                if (command == "0")
                {
                    break;
                }

                if (command == "1")
                {
                    var skillName = skillInputService.SkillInfoInput();
                    var skill     = skillService.Get(skillName);
                    skillList.Add(skill);
                }
                else
                {
                    string skillName = string.Empty;
                    skillName = InfoUnit.GetInfoUnit(skillName,
                                                     x => !string.IsNullOrEmpty(x.ToString()) && x.ToString().Length > 1,
                                                     "Enter skill name",
                                                     @"Error! skill name invalid!").ToString();

                    skillList.Add(skillService.Get(skillName.TrimStart()));
                }
            }
            return(new MaterialDTO(name, link, skillList));
        }
Ejemplo n.º 2
0
        public IActionResult Get(long id)
        {
            try
            {
                if (id == 0)
                {
                    _logger.LogInfo("paramter to get request is 0 or null");
                    return(BadRequest());
                }

                Skill skill = _skillService.Get(id);

                if (skill == null)
                {
                    _logger.LogInfo("skill not present with id" + id);
                    return(NotFound("The Skill record couldn't be found."));
                }

                return(Ok(skill));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest());
            }
        }
Ejemplo n.º 3
0
        public ActionResult Skills(int managerId)
        {
            if (managerId <= 0)
            {
                return(HttpNotFound());
            }

            int userId = User.Identity.GetUserId <int>();

            // проверяем, владелец ли резюме шлет запрос на его изменение
            if (!_managerService.IsOwnedBy(userId, managerId))
            {
                return(new HttpUnauthorizedResult());
            }

            ViewBag.ManagerId = managerId;
            var viewModel = _skillService.Get(managerId);

            if (viewModel == null)
            {
                return(View());
            }

            return(View(viewModel));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Details(int id)
        {
            if (id < 1)
            {
                return(NotFound());
            }
            var skill = await _skillService.Get(id);

            if (skill.ResultStatus == ResultStatus.Success)
            {
                return(View(skill.Data));
            }
            if (skill.ResultStatus == ResultStatus.Error)
            {
                return(NotFound());
            }
            return(View());
        }
Ejemplo n.º 5
0
 public ActionResult <List <SkillDto> > Get([FromHeader] Guid token)
 {
     try
     {
         ValidateToken(token);
         return(Ok(_skillService.Get()));
     }
     catch (AuthenticationException)
     {
         return(Unauthorized());
     }
     catch (ArgumentException e)
     {
         return(NotFound(e.Message));
     }
 }
Ejemplo n.º 6
0
        public void Extract(string inputDirectory)
        {
            try
            {
                _inputDirectory = inputDirectory;

                _monsterAlgorithm = ChickenContainer.Instance.Resolve <INpcMonsterAlgorithmService>();
                _skillService     = ChickenContainer.Instance.Resolve <ISkillService>();
                _skills           = _skillService.Get().ToDictionary(dto => dto.Id);
                ParseFile();
                ExtractFiles();
            }
            catch (Exception e)
            {
                Log.Error("Extract", e);
            }
        }
        public IHttpActionResult GetSkill(int id)
        {
            //get the skill first
            var skill = _skillService.Get(id);

            if (skill == null)
            {
                return(NotFound());
            }
            var model = skill.ToModel();

            return(RespondSuccess(new { Skill = model }));
        }
Ejemplo n.º 8
0
        public ActionResult <Skill> Get(long id)
        {
            try
            {
                var result = _skillService.Get(id);

                if (result == null)
                {
                    return(NotFound());
                }
                else
                {
                    return(Ok(result));
                }
            }
            catch (Exception ex)
            {
                return(UnprocessableEntity(ex));
            }
        }
Ejemplo n.º 9
0
 public ActionResult AddVideo()
 {
     ViewBag.Skills = skillService.Get();
     return(View());
 }
Ejemplo n.º 10
0
 public ActionResult <Skill> Get(int id)
 {
     return(StatusCode(StatusCodes.Status200OK, _skillService.Get(id, RootUrl)));
 }
Ejemplo n.º 11
0
 public PageResponse <SkillDTO> Get(QuerySettings settings)
 {
     return(_service.Get(settings));
 }
Ejemplo n.º 12
0
 public IndexViewModel(ISkillService skillService)
 {
     this.skillService = skillService;
     Skills            = skillService.Get().OrderBy(o => o.ParentSkillID);
 }
Ejemplo n.º 13
0
 public IndexViewModel(ISkillService skillService)
 {
     this.skillService = skillService;
     Skills = skillService.Get().OrderBy(o => o.ParentSkillID);
 }
Ejemplo n.º 14
0
 public BaseResponse <SkillOutputDto> Get(Guid id)
 {
     return(_skillService.Get(id));
 }
Ejemplo n.º 15
0
 public List <Skill> Get()
 {
     return(_skillService.Get());
 }
Ejemplo n.º 16
0
        // GET: api/Skills
        public IEnumerable <SkillDTO> Get()
        {
            var skills = skillService.Get();

            return(Mapper.Map <IEnumerable <Skill>, IEnumerable <SkillDTO> >(skills));
        }