Example #1
0
        public SkillViewModel AddSkill(SkillViewModel skill)
        {
            var skillToAdd = SkillMapper.MapModelToEntity(skill);

            skillToAdd.CreatedBy = "TEST";
            skillToAdd.SeedData  = false;
            var addedSkill = _skillRepository.Add(skillToAdd);

            return(SkillMapper.MapEntityToModel(addedSkill));
        }
Example #2
0
        public async Task <IActionResult> LikeUser(int id, int recipientId)
        {
            if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var like = await repo.GetLike(id, recipientId);

            if (like != null)
            {
                return(BadRequest("You already Follow this Guy"));
            }

            if (await repo.GetUser(recipientId) == null)
            {
                return(NotFound());
            }

            like = new Like
            {
                LikerId = id,
                LikeeId = recipientId
            };

            repo.Add <Like>(like);

            if (await repo.SaveAll())
            {
                return(Ok());
            }
            return(BadRequest("Failed to like User"));
        }
        public async Task <CreateSkillViewModel> Handle(CreateSkillCommand request, CancellationToken cancellationToken)
        {
            var skill = new Skill(request.Description);
            await _skillRepository.Add(skill);

            return(new CreateSkillViewModel(skill.Id, skill.Description));
        }
Example #4
0
        public async Task <Unit> Handle(CreateSkillCommand request, CancellationToken cancellationToken)
        {
            var skill = new Skill(request.Description);

            await _skillRepository.Add(skill);

            return(Unit.Value);
        }
        public ActionResult Create(Skill skill)
        {
            if (ModelState.IsValid)
            {
                _skillRepository.Add(skill);
                _skillRepository.Commit();

                return(RedirectToAction("Index"));
            }

            return(View(skill));
        }
Example #6
0
        public void AddRequiredSkills(Order order, params Skill[] skills)
        {
            foreach (var skill in skills)
            {
                if (_skillRepository.Find(s => s.Name == skill.Name) == null)
                {
                    _skillRepository.Add(skill);
                }

                order.RequiredSkills.Add(skill);
            }
        }
Example #7
0
        public void AddSkills(User user, params Skill[] skills)
        {
            foreach (var skill in skills)
            {
                if (_skillsRepository.Find(s => s.Name == skill.Name) == null)
                {
                    _skillsRepository.Add(skill);
                }

                user.Skills.Add(skill);
            }
        }
        public void NewSkillOKButton_Click()
        {
            ISkill newSkill = new Skill(this.subjectDetailsView.GrabNewSkillName(), "No description available");

            if (skillRepository.Add(newSkill))
            {
                PopulateSkillList();
            }
            else
            {
                this.subjectDetailsView.ShowErrorMessage("Skill name already exists! Please pick a different name.");
            }
            this.subjectDetailsView.ClearNewSkillTextBox();
        }
Example #9
0
        protected override async Task <SkillItem> DoExecute(SkillCreateContract message, ConsumeContext <SkillCreateContract> context)
        {
            var parent = await _skillCategoryRepository.DiscoverAsync(message.Parent);

            Logger.Trace($"Received contract to create SkillCategory, name is {message.Name}.");
            var mapped = _mapper.Map <SkillEntity>(context.Message);

            mapped.IsActive = true;
            mapped.Category = parent;
            await _repository.Add(mapped);

            Logger.Trace($"Created record for SkillCategory, id = {mapped.Id}.");
            return(_mapper.Map <SkillItem>(mapped));
        }
 public Skill Create(Skill entity)
 {
     try
     {
         entity.CreatedOn = DateTime.Now;
         entity.IsDeleted = false;
         _skillRepository.Add(entity);
         _unitOfWork.Commit();
         return(entity);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #11
0
 //cadastra a skill utilizando viewModel
 public void Add(CadastroSkillViewModel obj)
 {
     try
     {
         Skills skill = _mapper.Map <Skills>(obj);
         if (_skillRepository.Exists(skill))
         {
             throw new Exception("Skill já cadastrada!");
         }
         _skillRepository.Add(skill);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public IActionResult Create([FromBody] SkillDto skillVM)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var skill = new Skill {
                Name = skillVM.Name, IsReg = skillVM.IsReg, KeyWords = skillVM.KeyWords
            };

            _skillRepository.Add(skill);
            _skillRepository.Commit();
            _workerService.RegisterTask("skill", skill.Id);
            skillVM = Mapper.Map <Skill, SkillDto>(skill);
            CreatedAtRouteResult result = CreatedAtRoute("GetSkill", new { controller = "Skills", id = skillVM.Id }, skillVM);

            return(result);
        }
Example #13
0
        public ViewResult AddSkill(string?skillTitle, string?significiantPoints, string?feedback)
        {
            _showViewModel.PageTitle = "Nouvelle compétence ajoutée :";
            List <string> listSignificiantPoints = new List <string>();

            if (significiantPoints != null)
            {
                foreach (var s in significiantPoints.Split("\r\n"))
                {
                    listSignificiantPoints.Add(s);
                }
            }
            Skill skill = new Skill(skillTitle, listSignificiantPoints, feedback);

            _skillRepository.Add(skill);
            _showViewModel.Skills = _skillRepository.GetSkills();
            return(View("~/Views/Skill/ShowSkill.cshtml", _showViewModel));
        }
Example #14
0
        public async Task <IActionResult> Create([FromBody] Skill skill)
        {
            _logger.LogDebug("Starting save");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var newSkill = new Skill {
                Name = skill.Name
            };

            _skillRepository.Add(newSkill);
            await _skillRepository.SaveChangesAsync();

            _logger.LogDebug("Finished save");

            return(CreatedAtAction(nameof(Get), new { id = newSkill.Id }, newSkill));
        }
        public async Task <SkillV1> Handle(CreateSkillRequestV1 request, CancellationToken cancellationToken)
        {
            var skillAdded = await _skillRepository.Add(_mapper.Map <Skill>(request));

            return(_mapper.Map <SkillV1>(skillAdded));
        }
 public IActionResult Post([FromBody] Skill item)
 {
     _repository.Add(item);
     return(Ok());
 }
 public IActionResult Post(/*[FromBody]*/ Skill item)
 {
     _repository.Add(item);
     return(Ok(/*"New Skill Added.."*/));
 }
Example #18
0
 public IActionResult Post([FromBody] Skills item)
 {
     _repository.Add(item);
     return(Ok("Record Added"));
 }
Example #19
0
 public IActionResult Post(Skill Skill)
 {
     _skillRepository.Add(Skill);
     return(CreatedAtAction("Details", new { id = Skill.Id }, Skill));
 }
Example #20
0
        public void Insert(SkillViewModel model)
        {
            var contractType = AutoMapper.Mapper.Map <SkillViewModel, Skill>(model);

            _repository.Add(contractType);
        }
Example #21
0
 public void CreateSkill(SkillModel model)
 {
     _skillRepository.Add(model.ToEntity());
 }
 public void CreateSkill(Skill skill)
 {
     skillRepository.Add(skill);
 }
Example #23
0
        public SkillDto Create(SkillDto skill)
        {
            Skill newSkill = _skillRepository.Add(new Skill(skill.Name));

            return(SkillDto.Create(newSkill));
        }