public async Task CreateTypeProduit(CreateTypeProduit typeProduit) { try { await _stockApi.CreateTypeProduit(typeProduit); } catch (ApiException e) { throw new StockApiException(e.Message); } catch (Exception e) { _logger.LogError(e.Message); throw; } }
public async Task <ActionResult> CreateTypeProduit(CreateTypeProduit payload) { try { if (!ModelState.IsValid) { return(View()); } await _typeProduitService.CreateTypeProduit(payload); return(RedirectToAction(nameof(Index))); } catch (Exception e) { Logger.LogError(e.Message); throw; } }