public async Task <bool> UpdateAsync(Guid id, AccessoryForUpdateDto accessoryForUpdate) { var accessory = await _repositoryManager.Accessory.GetAccessoryAsync(CurrentUserId, id, true); if (accessory == null) { _logger.LogWarning("Accessory with id {Id} doesn't exists in db!", id); return(false); } _mapper.Map(accessoryForUpdate, accessory); _repositoryManager.Accessory.UpdateAccessory(accessory); await _repositoryManager.SaveAsync(); return(true); }
public async Task <IActionResult> PutAccessory(Guid id, AccessoryForUpdateDto accessoryForUpdate) { var accessory = await _accessoryService.UpdateAsync(id, accessoryForUpdate); return(!accessory?NotFound() : NoContent()); }