public IActionResult InsertTransaction([FromBody] TransactionLog log) { try { var user = User.Claims.FirstOrDefault(x => x.Type == "User"); if (user != null && !string.IsNullOrEmpty(user.Value)) { log.UserName = user.Value; } _transactionService.InsertTransactionLog(log); if (log.TransactionId.Length > 0) { return(Ok(log)); } else { return(BadRequest("Something failed")); } } catch (Exception ex) { return(Problem("Something is broke, yo")); } }