public async Task StoreAchat(CreateAchat achat) { try { await _stockApi.CreateAchat(achat); } catch (ApiException e) { throw new StockApiException(e.Message); } catch (Exception e) { Console.WriteLine(e); throw; } }
public async Task <ActionResult> CreateAchat([Bind()] CreateAchat payload) { try { if (!ModelState.IsValid) { return(NotFound()); } await _activiteService.StoreAchat(payload); return(RedirectToAction(nameof(Achats))); } catch (Exception e) { _logger.LogError(e.Message); throw; } }