public IActionResult ShipmentSpecialistList() { var shipmentSpecialistViewModels = new List <ShipmentSpecialistViewModel>(); foreach (var entity in _shipmentSpecialistService.GetShipmentSpecialists()) { shipmentSpecialistViewModels.Add(_mapperToViewModel.Map(entity)); } return(View(shipmentSpecialistViewModels)); }
public IActionResult OrderManager() { OrderManagerState ordersState = HttpContext.Session.Get <OrderManagerState>("orderManagerState"); if (ordersState == null) { ordersState = new OrderManagerState(); SaveOrderManagerState(ordersState); } var AllOrderViewModel = new List <OrderViewModel>(); foreach (var order in _orderService.GetOrdersToOrderManagerPage(ordersState)) //две обязанности... изменяет состояние otderstate { AllOrderViewModel.Add(_mapperToViewModel.Map(order)); } SaveOrderManagerState(ordersState); var orderManagerViewModel = new OrderManagerViewModel { orderViewModels = AllOrderViewModel, state = ordersState }; var managers = _managerService.GetManagers(); if (managers != null) { var managerList = new SelectList(managers, "Id", "Name"); ViewBag.managers = managerList.SetSelectedItemByValue(ordersState.FilterState.ValueOfFilterByManagerId.ToString()); } var shipSpecialists = _shipmentSpecialistService.GetShipmentSpecialists(); if (shipSpecialists != null) { var shipSpecialistsList = new SelectList(shipSpecialists, "Id", "Specialist"); ViewBag.shipmentSpecialists = shipSpecialistsList.SetSelectedItemByValue(ordersState.FilterState.ValueOfFilterByShipmentSpecId.ToString()); } var shipDestinations = _shipmentDestinationService.GetShipmentDestinations(); if (shipDestinations != null) { var shipSpecialistsList = new SelectList(shipDestinations, "Id", "Destination"); ViewBag.shipDest = shipSpecialistsList.SetSelectedItemByValue(ordersState.FilterState.ValueOfFilterByShipmentDestId.ToString()); } return(View(orderManagerViewModel)); }