Exemplo n.º 1
0
        public ActionResult KendoRead([DataSourceRequest] DataSourceRequest request, int PreCommissionId)
        {
            if (!request.Sorts.Any())
            {
                request.Sorts.Add(new SortDescriptor("PreCommisoningDate", ListSortDirection.Descending));
            }

            DataSourceResult result = CustomRepository.GetPreCommisioningDetailData(PreCommissionId).ToDataSourceResult(request);
            //DataSourceResult result = _dbRepository.GetEntities().Where(m => m.PreCommissionId == PreCommissionId).ToDataSourceResult(request);
            List <GetPreCommisioningDetailData_Result> list = result.Data as List <GetPreCommisioningDetailData_Result>;

            foreach (GetPreCommisioningDetailData_Result obj in list)
            {
                if (obj.PCAccesseriesId > 0)
                {
                    obj.PCAccessoryIdList = new List <int>();
                    obj.PCAccessoryIdList.Add(obj.PCAccesseriesId.Value);
                }
                if (obj.PCMachineId > 0)
                {
                    obj.PCMachineIdList = new List <int>();
                    obj.PCMachineIdList.Add(obj.PCMachineId.Value);
                }
            }
            return(Json(list.ToDataSourceResult(request)));
        }