private static void CreatePartyNavigation(NavigationViewModel navigation, Entities.Entity entity, UrlHelper urlHelper) { NavigationSectionViewModel partySection = new NavigationSectionViewModel() { Name = "Party" }; var party = entity.Party; partySection.Children.Add(new NavigationSectionViewModel() { Name = "Messages", Url = urlHelper.Action("Index", "Message") }); partySection.Children.Add(new NavigationSectionViewModel() { Name = "Profile", Url = urlHelper.Action("View", "Party", new { partyID = party.ID }) }); partySection.Children.Add(new NavigationSectionViewModel() { Name = "Newspapers", Url = urlHelper.Action("Index", "Newspaper") }); navigation.MainSections.Add(partySection); }
public State(string name, Entity entity) { this.name = name; m_entity = entity; }
private static void CreateNewspaperNavigation(NavigationViewModel navigation, Entities.Entity entity, UrlHelper urlHelper) { NavigationSectionViewModel newspaperSection = new NavigationSectionViewModel() { Name = "Newspaper" }; newspaperSection.Children.Add(new NavigationSectionViewModel() { Name = "Profile", Url = urlHelper.Action("View", "Newspaper", new { newspaperID = entity.EntityID }) }); newspaperSection.Children.Add(new NavigationSectionViewModel() { Name = "Create article", Url = urlHelper.Action("WriteArticle", "Newspaper", new { newspaperID = entity.EntityID }) }); newspaperSection.Children.Add(new NavigationSectionViewModel() { Name = "Manage articles", Url = urlHelper.Action("ManageArticles", "Newspaper", new { newspaperID = entity.EntityID }) }); newspaperSection.Children.Add(new NavigationSectionViewModel() { Name = "Manage journalists", Url = urlHelper.Action("ManageJournalists", "Newspaper", new { newspaperID = entity.EntityID }) }); navigation.MainSections.Add(newspaperSection); }
private static void CreateCitizenNavigation(NavigationViewModel navigation, Entities.Entity entity, UrlHelper urlHelper) { NavigationSectionViewModel citizenSection = new NavigationSectionViewModel() { Name = "Citizen" }; var citizen = entity.Citizen; var hotel = citizen.HotelRooms.Where(r => r.Hotel.RegionID == citizen.RegionID).Select(r => r.Hotel).FirstOrDefault(); citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Profile", Url = urlHelper.Action("View", "Citizen", new { citizenID = citizen.ID }) }); var house = citizen.GetCurrentlyLivingHouse(); if (house != null) { citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Current house", Url = urlHelper.Action("View", "House", new { houseID = house.ID }) }); } if (house != null || citizen.Houses.Any()) { citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Your houses", Url = urlHelper.Action("Index", "House") }); } citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Messages", Url = urlHelper.Action("Index", "Message") }); citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Inventory", Url = urlHelper.Action("Inventory", "Citizen", new { ID = citizen.ID }) }); citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Training", Url = urlHelper.Action("Index", "Training") }); citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Travel", Url = urlHelper.Action("Travel", "Citizen") }); if (citizen.CompanyEmployee != null) { var companyID = citizen.CompanyEmployee.CompanyID; citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Job", Url = urlHelper.Action("View", "Company", new { companyID = companyID }) }); } if (citizen.PartyMember != null) { var partyID = citizen.PartyMember.PartyID; citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Party", Url = urlHelper.Action("View", "Party", new { PartyID = partyID }) }); } else { int?countryID = citizen.Region.CountryID; if (countryID.HasValue) { citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Parties", Url = urlHelper.Action("Parties", "Party", new { countryID = countryID }) }); } } citizenSection.Children.Add(new NavigationSectionViewModel() { Name = "Wallet", Url = urlHelper.Action("Wallet", "Citizen") }); if (hotel != null) { citizenSection.Children.Add(new NavigationSectionViewModel() { Name = $"Staying at {hotel.Entity.Name}", Url = urlHelper.Action("View", "Hotel", new { hotelID = hotel.ID }) }); } navigation.MainSections.Add(citizenSection); createBusinessSection(navigation, urlHelper, createCompanies: true, createOrganisations: true, createNewspapers: true); }