Exemplo n.º 1
0
        public async Task <IActionResult> BulkAddInventoryAsync([FromBody] List <Inventory> inventory)
        {
            try
            {
                _logger.LogDebug("Bulk inserting Inventory parts");
                bool success = await _inventoryService.BulkAddAsync(inventory);

                if (success)
                {
                    _logger.LogDebug("Bulk Insert Sucess");
                    return(Ok("Inventory Bulk Add successfully"));
                }
                else
                {
                    _logger.LogDebug("Bulk Insert Failed");
                    return(Conflict("Error Bulk Adding"));
                }
            }
            catch (Exception ex)
            {
                //log
                Console.Error.WriteLine($"Inventory Controller Error: Method: BulkAdd, Error:{ex.InnerException.Message} ");
                _logger.LogError("An Exception occured: {ex}", ex.Message);
                _logger.LogError("Stack Trace: {ex}", ex.StackTrace);
                return(BadRequest());
            }
        }