Esempio n. 1
0
        public async Task <IActionResult> Post([FromBody] DtoResumeDrivingLicenseType dto)
        {
            var entity = Mapper.Map <ResumeDrivingLicenseType>(dto);

            _context.ResumeDrivingLicenseTypes.Add(entity);

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

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

            template.Id = id;

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

            return(Ok(id));
        }