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

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

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

            template.Id = id;

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

            return(Ok(id));
        }