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

            _context.VacancySpecializations.Add(entity);

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

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

            template.Id = id;

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

            return(Ok(id));
        }