Пример #1
0
 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;
     }
 }
Пример #2
0
        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;
            }
        }