コード例 #1
0
        public async Task <IActionResult> PutAsset(string app, Guid id, [FromBody] AssetUpdateDto request)
        {
            var command = SimpleMapper.Map(request, new RenameAsset {
                AssetId = id
            });

            await CommandBus.PublishAsync(command);

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> UpdateAsset(AssetUpdateDto assetUpdateDto)
        {
            try
            {
                var asset = _mapper.Map <Asset>(assetUpdateDto);
                asset.UpdatedAt = DateTime.Now;
                context.Assets.Update(asset);
                await context.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
コード例 #3
0
        public async Task <IActionResult> PutAsset(string app, Guid id, [FromBody] AssetUpdateDto request)
        {
            await CommandBus.PublishAsync(request.ToCommand(id));

            return(NoContent());
        }