Receive integer value in field view

0

Personal I need your help.

In my system I created a modal with data visualization pulling from the bank.

I need one of these data to display only the integers, as an example in the photo.

If 30.0 is required to display 30, if 265.0 is required to display 265 only.

Can anyone help me?

ControllerfromwhereImakethecalculationsandsteptotheJS

[HttpPost]publicJsonResultMethodGetDetails(intcentroId=0){varcentro=_hospitalService.GetByCentroId(centroId);List<string>list=newList<string>();if(centro!=null){//EstoqueAlist.Add((centro.EstoqueA*2).ToString("N1"));//3

                // Estoque B
                list.Add((centro.EstoqueB * 2).ToString("N1"));//6

                // Estoque C
                list.Add((centro.EstoqueC * 2).ToString("N1"));//9

                // Estoque D
                list.Add((centro.EstoqueD * 2).ToString("N1"));//12

                // Estoque E
                list.Add((centro.EstoqueE * 2).ToString("N1"));//15

                // Estoque F
                list.Add((centro.EstoqueF * 2).ToString("N1"));//18


                list.Add(centro.Nome);
            }

            return Json(list, JsonRequestBehavior.AllowGet);
        }

JAvaScript:

function MethodGetDetails(id) {
    console.log(id);
    $.ajax({
        method: 'POST',
        url: 'MethodGetDetails',
        data: { centroId: id },
        success: function (response) {
            console.log('success: ' + response);
            $('.modal.MethodGetDetailsModal').modal('show');
            $('#trAddTD').text('');
            $('#nomeCentro').html(id + ' - ' + response[18]);

            $('#trAddTD').html(
               '<div class="row">' +
               '    <div class="col-md-12">' +
               '        <div class="row" style="margin-top: 15px;">' +
               '            <div class="col-md-6" style="padding-left: 20px;">' +
               '                <label>A: </label>' +
               '                <span data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-flask"></i> <label>' + response[2] + ' </label></span>        ' +
               '            </div>' +
               '            <div class="col-md-6">' +
               '                <label>D: </label>' +
               '                <span data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-flask"></i> <label>' + response[5] + ' </label></span>        ' +
               '            </div>' +
               '        </div>' +
               '        <div class="row" style="margin-top: 15px;">' +
               '            <div class="col-md-6" style="padding-left: 20px;">' +
               '                <label>B: </label>' +
               '                <span data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-flask"></i> <label>' + response[8] + ' </label></span>        ' +
               '            </div>' +
               '            <div class="col-md-6">' +
               '                <label>E: </label>' +
               '                <span data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-flask"></i> <label>' + response[11] + ' </label></span>        ' +
               '            </div>' +
               '        </div>' +
               '        <div class="row" style="margin-top: 15px;">' +
               '            <div class="col-md-6" style="padding-left: 20px;">' +
               '                <label>C: </label>' +
               '                <span data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-flask"></i> <label>' + response[14] + ' </label></span>        ' +
               '            </div>' +
               '            <div class="col-md-6">' +
               '                <label>F: </label>' +
               '                <span data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-flask"></i> <label>' + response[17] + ' </label></span>        ' +
               '            </div>' +
               '        </div>' +
               '    </div>' +
               '</div>');


        }
    })
}

MODAL CSHTML:

<div class="modal fade MethodGetDetailsModal" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Estoque Atual</h4>
            </div>
            <div class="modal-body">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th id="nomeCentro"></th>
                        </tr>
                    </thead>
                    <tbody id="trAddTD"></tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-warning btn-loading" data-dismiss="modal" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Carregando">Fechar</button>
            </div>
        </div>
    </div>
</div>
    
asked by anonymous 16.03.2018 / 14:52

1 answer

0

Instead of formatting as "N1" in ToString use "F0", which causes it to have 0 numbers after the comma.

    
16.03.2018 / 15:04