I have an application and I can add in this application. I need to save the Id number of the user who made the addition in my database. I do the insertion with AJAX and Jquery. But I do not know how to access the Id of the logged in user and post it.
Can you help?
This is my Jquery and Ajax Codes
  $(document).on('click', '#addButton', function () {
    //
    var DriverName = $('#AddModal #driverName').val();
    var PlateNumber = $('#AddModal #plateNumber').val();
    var TrailerNumber = $('#AddModal #trailerNumber').val();
    var SealNumber = $('#AddModal #sealNumber').val();
    var ProcessDate = $('#AddModal #processDate').val();
    var ProcessType = $('#AddModal #ProcessTypeName option:selected').val();
    var Personels = $('#AddModal #personels option:selected').val();
    var ReasonToVisit = $('#AddModal #reasonTo').val();
    var CreatedUserId=@User
    //
    var ItemLoadModels = new Array();
    var VehicleLoginCreate = {};
    //
    VehicleLoginCreate.DriverName = DriverName;
    VehicleLoginCreate.PlateNumber = PlateNumber;
    VehicleLoginCreate.TrailerNumber = TrailerNumber;
    VehicleLoginCreate.SealNumber = SealNumber;
    VehicleLoginCreate.ProcessDate = ProcessDate;
    VehicleLoginCreate.ProcessTypeId = ProcessType;
    VehicleLoginCreate.PersonnelId = Personels;
    VehicleLoginCreate.ReasonToVisit = ReasonToVisit;
    VehicleLoginCreate.ItemLoadModels = ItemLoadModels;
    //.
    $("#AddItemsTable tr:not(:first)").each(function () {
        let ItemLoadModel = {
            Id: "", RowId: "",   OrderNo: "", ItemName: 0, DeclarationNumber: "", T1Number: "", ShipperId: "", ConsigneeId: "", CaseCount: "", CaseCountType: "",
            Weight: 0.00, WeightType: ""
        }
        ItemLoadModel.OrderNo = $('#AddModal #Order').val();
        ItemLoadModel.ItemName = $('#AddModal #Item').val();
        ItemLoadModel.DeclarationNumber = $('#AddModal #Declaration').val();
        ItemLoadModel.T1Number = $('#AddModal #T1').val();
        ItemLoadModel.ShipperId = $('#AddModal #shipperd').val();
        ItemLoadModel.ConsigneeId = $('#AddModal #consignee').val();
        ItemLoadModel.CaseCount = $('#AddModal #Case').val();
        ItemLoadModel.CaseCountType = $('#AddModal #caseType').val();
        ItemLoadModel.Weight = $('#AddModal #Weight').val();
        ItemLoadModel.WeightType = $('#AddModal #weightTypes').val();
        ItemLoadModel.Id = $('#AddModal #id').val();
        ItemLoadModel.RowId = $('#AddModal #rowId').val();
        ItemLoadModels.push(ItemLoadModel);
    });
    //
    console.log(VehicleLoginCreate);
    alert(VehicleLoginCreate);
    $.ajax({
        type: 'POST',
        url: '/VehicleLogin/AddVehicleLogin',
        data: VehicleLoginCreate,
        success: function (result) {
            alert('Ekleme İşlemi Başarılı.');
            console.log(result);
            setInterval('location.reload()', 700);
        },
        error: function () {
            alert('Ekleme İşlemi Başarısız.');
            console.log('Failed ');
        }
    });
});
I have an application and I can add in this application. I need to save the Id number of the user who made the addition in my database. I do the insertion with AJAX and Jquery. But I do not know how to access the Id of the logged in user and post it.
 
    