예제 #1
0
        public async Task <IActionResult> Save([FromBody] DtoVacancyTest dto)
        {
            var template = Mapper.Map <VacancyTest>(dto);

            _context.VacancyTests.Add(template);
            await _context.SaveChangesAsync()
            .ConfigureAwait(false);

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

            template.Id = id;

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

            return(Ok(id));
        }