Esempio n. 1
0
        public async Task <IActionResult> BulkAddInquiryAsync([FromBody] List <Inquiry> inquiry)
        {
            try
            {
                _logger.LogDebug("Bulk inserting inquiry parts");
                bool success = await _inquiryService.BulkAddAsync(inquiry);

                if (success)
                {
                    _logger.LogDebug("Bulk Insert Sucess");
                    return(Ok("Inquiry Bulk Add successfully"));
                }
                else
                {
                    _logger.LogDebug("Bulk Insert Failed");
                    return(Conflict("Error Bulk Adding"));
                }
            }
            catch (Exception ex)
            {
                //log
                Console.Error.WriteLine($"Inquiry 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());
            }
        }