public async Task <bool> UpdateAsync(Guid id, ConsumableForUpdateDto consumableForUpdate) { var consumable = await _repositoryManager.Consumable.GetConsumableAsync(CurrentUserId, id, true); if (consumable == null) { _logger.LogWarning("There is no consumable in db with such id {Id}!", id); return(false); } _mapper.Map(consumableForUpdate, consumable); _repositoryManager.Consumable.UpdateConsumable(consumable); await _repositoryManager.SaveAsync(); return(true); }
public async Task <IActionResult> PutConsumable(Guid id, ConsumableForUpdateDto consumableForUpdate) { var consumable = await _consumableService.UpdateAsync(id, consumableForUpdate); return(consumable ? NoContent() : NotFound()); }