/// <summary> /// Initializes a new instance of the <see cref="ProducersAndMaterialsTabItemViewModel"/> class. /// </summary> /// <param name="modalDialogProvider">The modal dialog service.</param> /// <param name="serviceFactory">The service factory.</param> public ClientsAndBuildingsTabItemViewModel(IMainViewModel mainViewModel, IModalDialogProvider modalDialogProvider, IServiceFactory serviceFactory) : base(mainViewModel, modalDialogProvider, serviceFactory) { BuildingDetailsViewModel = new BuildingDetailsViewModel(MainViewModel, ModalDialogProvider, ServiceFactory); BuildingListViewModel = new BuildingListViewModel(MainViewModel, BuildingDetailsViewModel, ModalDialogProvider, ServiceFactory); ClientDetailsViewModel = new ClientDetailsViewModel(MainViewModel, BuildingListViewModel, ModalDialogProvider, ServiceFactory); ClientListViewModel = new ClientListViewModel(MainViewModel, ClientDetailsViewModel, ModalDialogProvider, ServiceFactory); ViewModelProvider.RegisterChildViewModel(ClientDetailsViewModel, ViewModelProviderAction.IsReadOnlyChanged); ViewModelProvider.RegisterChildViewModel(BuildingDetailsViewModel, ViewModelProviderAction.IsReadOnlyChanged); }
// GET: /Building/Details/5 public IActionResult Details(int id) { var rooms = new BuildingRoomsViewModel() { BuildingNumber = id, Rooms = _roomRepository.GetBuildingRooms(id).ToList() }; var buildingDetails = new BuildingDetailsViewModel() { Building = _buildingRespository.GetById(id), Rooms = rooms }; return(View(buildingDetails)); }