public ActionResult CreateWaybillRequest(long waybillId)
        {
            var waybill = _waybillService
                          .GetWaybillModel(waybillId);

            var usedRequestIds = _waybillService
                                 .GetAllWaybillRequestModels(waybillId, null)
                                 .Select(x => x.Request.Id);

            var requests = _requestService.GetAllModels()
                           .Where(x => !usedRequestIds.Contains(x.Id))
                           .WhereIf(waybill?.WaybillDateTime != null,
                                    x => x.PlannedDateTime.Date == waybill.WaybillDateTime.Date)
                           .Select(x => new SelectListItem {
                Value = x.Id.ToString(), Text = x.Address
            })
                           .ToList();

            var model = new WaybillRequestSaveModel
            {
                WaybillId = waybillId.ToString()
            };

            var editWindowModel = new WaybillsRequestsEditWindowModel <WaybillRequestSaveModel>(model, requests);


            return(View("Partial/CreateWaybillRequest", editWindowModel));
        }
Пример #2
0
        public HttpResponseMessage List(long id, StoreLoadParams storeLoadParams)
        {
            var result = _waybillsService.GetAllWaybillRequestModels(id, storeLoadParams);

            return(Success(result));
        }