Link sends null array

1

I have a search screen and need to send a parameter as array, that part was quiet, the big problem is that this screen is paged, so in the page change links I put to send this parameter, but it is always sent null.

Codes:

  

Controller

   public ActionResult Index(
            int?[] status = null,
            string company = null,
            string supervisingconsultant = null,
            string supervisingsalessupport = null,
            string consultant = null,
            string salessupport = null,
            string search = null,
            int? page = null,
            bool control = true)
        {
            var user = returnUser(User.Identity.GetUserId());
            int pageNumber = (page ?? 1);

            if (status != null)
                foreach (int i in status)
                    if (i == 0)
                    {
                        status = null;
                        break;
                    }

            if (!Request.IsAjaxRequest())
            {
                var functions = returnFunctions(user);
                company = user.user_company_id;
                supervisingconsultant = functions[0];
                supervisingsalessupport = functions[1];
                consultant = functions[2];
                salessupport = functions[3];
            }
            else
            {
                if (control)
                    page = 1;
            }

            ViewBag.status = status;
            ViewBag.company = company;
            ViewBag.supervisingconsultant = supervisingconsultant;
            ViewBag.supervisingsalessupport = supervisingsalessupport;
            ViewBag.consultant = consultant;
            ViewBag.salessupport = salessupport;
            ViewBag.search = search;

            var client = _clientAppService.ListClients(status, company, supervisingconsultant, supervisingsalessupport, consultant, salessupport, search, pageNumber);
            var pagedViewModel = Mapper.Map<IEnumerable<Client>, IEnumerable<ClientViewModel>>(client.ToArray());
            var clientViewModel = new StaticPagedList<ClientViewModel>(pagedViewModel, client.GetMetaData());

            foreach (var i in clientViewModel)
            {
                var x = returnUser(i.client_supervisingconsultant);
                i.client_supervisingconsultant = returnName(x.user_name);

                x = returnUser(i.client_consultant);
                i.client_consultant = returnName(x.user_name);

                switch (i.client_statusnegotiation)
                {
                    case (1):
                        i.client_statusnegotiationdescription = "(10%) - VISITA AGENDADA.";
                        break;
                    case (2):
                        i.client_statusnegotiationdescription = "(25%) - PROPOSTA APRESENTADA.";
                        break;
                    case (3):
                        i.client_statusnegotiationdescription = "(50%) - PROPOSTA ACEITA.";
                        break;
                    case (4):
                        i.client_statusnegotiationdescription = "(75%) - CONTRATO ASSINADO.";
                        break;
                    case (5):
                        i.client_statusnegotiationdescription = "(100%) - CONTRATO FECHADO.";
                        break;
                    case (6):
                        i.client_statusnegotiationdescription = "CONTRATO APROVADO.";
                        break;
                    case (7):
                        i.client_statusnegotiationdescription = "CONTRATO REPROVADO.";
                        break;
                    case (8):
                        i.client_statusnegotiationdescription = "PERDIDO.";
                        break;
                }
            }

            if (Request.IsAjaxRequest())
                return PartialView("_Clients", clientViewModel);

            string[] names = user.user_name.Split(' ');
            var systemFunction = new Functions().FunctionsList().First(x => x.Id == user.user_function);

            ViewBag.User = user;
            ViewBag.FirstName = names[0].ToLower();
            ViewBag.LastName = names[names.Length - 1].ToLower();
            ViewBag.Photograph = (string.IsNullOrEmpty(user.user_photograph)) ? "/assets/usersPhoto/noPhoto.png" : user.user_photograph;
            ViewBag.Function = systemFunction.Name;

            ViewBag.CompanyList = new SelectList(_companyAppService.GetAll(), "company_id", "company_fantasyname", company);
            ViewBag.SupervisingConsultantList = new SelectList(_userAppService.CollaboratorList(company, null, 2), "Id", "user_name", supervisingconsultant);
            ViewBag.ConsultantList = new SelectList(_userAppService.CollaboratorList(company, supervisingconsultant, 4), "Id", "user_name", consultant);
            ViewBag.SupervisingSalessupportList = new SelectList(_userAppService.CollaboratorList(company, null, 3), "Id", "user_name", supervisingsalessupport);
            ViewBag.SalessupportList = new SelectList(_userAppService.CollaboratorList(company, supervisingsalessupport, 5), "Id", "user_name", salessupport);

            return View(clientViewModel);
        }
  

Partial View

   @using PagedList.Mvc;
@model PagedList.IPagedList<SigconWEB.MVC.ViewModels.ClientViewModel>

<div id="ClentsList">
    <div class="panel-body">
        <div class="pull-left">
            Exibindo @Model.Count de @Model.TotalItemCount clientes
        </div>
        <div class="table-responsive">

            <table class="table table-striped table-bordered table-hover" style="width: 1850px;">
                <thead>
                    <tr>
                        <th width="150" class="text-center">Ações</th>
                        <th width="150">
                            Data e Hora de entrada
                        </th>
                        <th width="200">
                            Supervisor(a) de consultor(a)
                        </th>
                        <th width="200">
                            Consultor(a)
                        </th>
                        <th width="350">
                            Nome fantasia
                        </th>
                        <th width="150">
                            Voz
                        </th>
                        <th width="150">
                            Web
                        </th>
                        <th width="150">
                            Renegociação
                        </th>
                        <th width="350">
                            Status negociação
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr id="@Html.DisplayFor(modelItem => item.client_id)" data-url="/Clients/Delete">
                            <td class="text-center">
                                <a href="@Url.Action("Profile", new { id = item.client_id })" class="btn btn-success btn-xs" data-toggle="tooltip" data-placement="top" data-original-title="Ver perfil"><i class="fa fa-eye"></i></a>
                                <a href="@Url.Action("Edit", new { id = item.client_id })" class="btn btn-primary btn-xs" data-toggle="tooltip" data-placement="top" data-original-title="Editar"><i class="fa fa-pencil"></i></a>
                                <a class="btn btn-danger btn-xs delete-line" data-toggle="tooltip" data-placement="top" data-original-title="Deletar"><i class="fa fa-times"></i></a>
                            </td>
                            <td>@Html.DisplayFor(modelItem => item.client_dateregister)</td>
                            <td>@Html.DisplayFor(modelItem => item.client_supervisingconsultant)</td>
                            <td>@Html.DisplayFor(modelItem => item.client_consultant)</td>
                            <td>@Html.DisplayFor(modelItem => item.client_fantasyname)</td>
                            <td>@Html.DisplayFor(modelItem => item.client_voice)</td>
                            <td>@Html.DisplayFor(modelItem => item.client_web)</td>
                            <td>@Html.DisplayFor(modelItem => item.client_renegotiation)</td>
                            <td>@Html.DisplayFor(modelItem => item.client_statusnegotiationdescription)</td>
                        </tr>
                    }
                </tbody>
            </table>

        </div>

    </div><!-- /.panel-body -->
    <div class="panel-footer">
        <div class="pull-left">
            Página @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) de @Model.PageCount
        </div>
        <div class="pull-right">
            @Html.PagedListPager(Model, page => Url.Action("Index", new { status = ViewBag.status, company = ViewBag.company, supervisingconsultant = ViewBag.supervisingconsultant, supervisingsalessupport = ViewBag.supervisingsalessupport, consultant = ViewBag.consultant, salessupport = ViewBag.salessupport, search = ViewBag.search, page, control = false }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "ClentsList" }))
        </div>
        <div class="clearfix"></div>
    </div><!-- /.panel-footer -->
</div>
    
asked by anonymous 05.10.2016 / 16:08

0 answers