Example #1
0
        public async Task <IActionResult> Post([FromBody] DtoVacancySkill dto)
        {
            var entity = Mapper.Map <VacancySkill>(dto);

            _context.VacancySkills.Add(entity);

            await _context
            .SaveChangesAsync()
            .ConfigureAwait(false);

            return(Ok(entity.Id));
        }
Example #2
0
        public async Task <IActionResult> Update([FromBody] DtoVacancySkill dto, [FromRoute] long id)
        {
            var template = Mapper.Map <VacancySkill>(dto);

            template.Id = id;

            await _context.VacancySkills
            .Where(x => x.Id == id)
            .UpdateFromQueryAsync(_ => template)
            .ConfigureAwait(false);

            return(Ok(id));
        }