public async Task <IActionResult> Update(int id, OrchestralBriefcaseUpdateDto updateDto)
        {
            if (id != updateDto.Id)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(ValidationProblem(ModelState));
            }

            await _orchestralBriefcaseService.UpdateAsync(updateDto);

            return(Ok());
        }
        public async Task UpdateAsync(OrchestralBriefcaseUpdateDto updateDto)
        {
            var entity = await _dbContext.OrchestralBriefcases
                         .FindAsync(updateDto.Id)
                         .ConfigureAwait(false);

            if (entity is null)
            {
                throw new NotFoundException(nameof(OrchestralBriefcase), updateDto.Id);
            }

            entity.Name = updateDto.Name;

            await _dbContext
            .SaveChangesAsync()
            .ConfigureAwait(false);
        }
Exemplo n.º 3
0
        public Task UpdateAsync(int id, OrchestralBriefcaseUpdateDto updateDto)
        {
            string endpoint = $"{_baseEndpoint}/{id}";

            return(_httpClient.PutAsJsonAsync(endpoint, updateDto));
        }