public async Task <IActionResult> AddQuotationAsync([FromBody] Quotation quotation) { try { _logger.LogDebug("Adding new quotation"); quotation.DateCreated = DateTime.Now; quotation.DateUpdated = DateTime.Now; quotation.IsActive = 1; bool success = await _quotationService.AddAsync(quotation); if (success) { _logger.LogDebug("Quoatation insert operation success."); return(Ok("Quotation created successfully")); } else { _logger.LogDebug("Quoation insert operation failed. Quoatation already exists."); return(Conflict("Duplicate Quotation")); } } catch (Exception ex) { //log _logger.LogError("An Exception occured: {ex}", ex.Message); _logger.LogError("Stack Trace: {ex}", ex.StackTrace); return(BadRequest()); } }