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

            _context.ResumeSkills.Add(entity);

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

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

            template.Id = id;

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

            return(Ok(id));
        }