コード例 #1
0
        public async Task <IActionResult> Post([FromBody] DtoResumeEmployment dto)
        {
            var entity = Mapper.Map <ResumeEmployment>(dto);

            _context.ResumeEmployments.Add(entity);

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

            return(Ok(entity.Id));
        }
コード例 #2
0
        public async Task <IActionResult> Update([FromBody] DtoResumeEmployment dto, [FromRoute] long id)
        {
            var template = Mapper.Map <ResumeEmployment>(dto);

            template.Id = id;

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

            return(Ok(id));
        }