Ejemplo n.º 1
0
        public async Task <IActionResult> AddInquiryAsync([FromBody] Inquiry inquiry)
        {
            try
            {
                _logger.LogDebug("Inserting new Inquiry Part");
                bool success = await _inquiryService.AddAsync(inquiry);

                if (success)
                {
                    _logger.LogDebug("Inquiry Part Inserted successfully ");
                    return(Ok("Inquiry part created successfully"));
                }
                else
                {
                    _logger.LogDebug("Inquiry Insert failed. Duplicate Inquiry part found");
                    return(Conflict("Duplicate Inquiry part"));
                }
            }
            catch (Exception ex)
            {
                //log
                _logger.LogError("An Exception occured: {ex}", ex.Message);
                _logger.LogError("Stack Trace: {ex}", ex.StackTrace);
                return(BadRequest());
            }
        }