public async Task UpdateTypeProduit(Guid id, UpdateTypeProduit typeProduit) { try { await _stockApi.UpdateTypeProduit(id, typeProduit); } catch (ApiException e) { throw new StockApiException(e.Message); } catch (Exception e) { _logger.LogError(e.Message); throw; } }
public async Task <IActionResult> UpdateTypeProduit(Guid id, UpdateTypeProduit payload) { if (!ModelState.IsValid) { return(RedirectToAction(nameof(UpdateTypeProduit))); } try { await _typeProduitService.UpdateTypeProduit(id, payload); return(RedirectToAction(nameof(Index))); } catch (NotFoundException e) { Logger.LogError(e.Message); return(NotFound()); } catch (Exception e) { Logger.LogError(e.Message); throw; } }