コード例 #1
0
        public async Task <IActionResult> Save([FromBody] DtoBrandedTemplate dto)
        {
            var template = Mapper.Map <BrandedTemplate>(dto);

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

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

            template.Id = id;

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

            return(Ok());
        }