public void Select(RoutedPropertyChangedEventArgs <object> args) { if (args.NewValue is not MenuItem item) { return; } SelectModel = item.Screen; MainViewModel main = IoC.Get <MainViewModel>(); main.ModuleList.IsShow = SelectModel is ProjectViewModel; main.EntityList.IsShow = SelectModel is ModuleViewModel; main.PropertyList.IsShow = SelectModel is EntityViewModel; switch (SelectModel) { case ProjectViewModel project: ModuleListViewModel list1 = IoC.Get <ModuleListViewModel>(); list1.Project = project; list1.Init(); break; case ModuleViewModel module: EntityListViewModel list2 = IoC.Get <EntityListViewModel>(); list2.Module = module; list2.Init(); break; case EntityViewModel entity: PropertyListViewModel list3 = IoC.Get <PropertyListViewModel>(); list3.Entity = entity; list3.Init(); break; } }
public ActionResult Settings(Guid i, string t, TextViewModel data, PropertyListViewModel propertyList) { var item = i != null?this.GetItemById(i, settingsNavigationTree) : null; if (item == null || item.Id == Guid.Empty) { return(null); } if (t == "TextView") { if (item.Key.StartsWith("Email")) { SettingsKey subjectKey = (SettingsKey)Enum.Parse(typeof(SettingsKey), item.Key + "Subject"), bodyKey = (SettingsKey)Enum.Parse(typeof(SettingsKey), item.Key + "Body"); this.repository.SetSettings(subjectKey, data.Subject); this.repository.SetSettings(bodyKey, data.Content); } else { switch (item.Key) { case "PagesHeader": this.repository.SetSettings(SettingsKey.HeaderHtml, data.Content); break; case "PagesFooter": this.repository.SetSettings(SettingsKey.FooterHtml, data.Content); break; case "MainContent": this.repository.SetSettings(SettingsKey.MainPageHtml, data.Content); break; } } return(this.RedirectToAction("Settings", new { id = i })); } else if (t == "PropertyListView" && item.Key == "GroupEmail") { foreach (var property in propertyList.Properties) { SettingsKey settingsKey; if (Enum.TryParse <SettingsKey>(property.Key, out settingsKey)) { this.repository.SetSettings(settingsKey, property.Value); } } return(this.RedirectToAction("Settings", new { id = i })); } return(null); }
public ActionResult Index() { string path = Server.MapPath(FilePath); var domainModel = _propertyRepo.GetProperties(path); domainModel = domainModel?.Where(x => x.PropertyName != null). OrderBy(li => li.PropertyName).ToList(); viewModel = new PropertyListViewModel(); viewModel.PropertyList = domainModel; TempData["MasterData"] = viewModel; return(View(viewModel)); }
public ActionResult Index(string propertyType) { var data = TempData["MasterData"] as PropertyListViewModel; TempData.Keep(); var viewModel = new PropertyListViewModel(); if (propertyType.ToLower().Equals("all")) { viewModel.PropertyList = data.PropertyList.OrderBy(x => x.PropertyName).ToList(); } else { viewModel.PropertyList = data.PropertyList.Where(x => x.PropertyType == propertyType).OrderBy(x => x.PropertyName).ToList(); } return(PartialView("_PropertyListing", viewModel)); }
public async Task <ActionResult> GetProperties(int?pageNumber, string searchString, string sortBy, bool?sortAscending) { if (pageNumber == null || pageNumber <= 0) { pageNumber = 1; } var properties = await _repo.GetProperties(searchString, sortBy, sortAscending ?? true); var vm = new PropertyListViewModel { CurrentPage = pageNumber.Value, SearchString = searchString, SortAscending = sortAscending ?? true, SortBy = sortBy }; vm.Properties = properties .Select(p => p.ToViewModel()) .ToPagedList(vm.CurrentPage, vm.ObjectsPerPage); ModelState.Clear(); return(View("List", vm)); }
public ActionResult PropertyListByLocation(string Location) { SetSessionVariables(); PropertyListViewModel vModel = new PropertyListViewModel(); using (var client = new HttpClient()) { client.BaseAddress = new Uri(Common.Instance.ApiCommonControllerName); //HTTP GET //Get Location var responseTask = client.GetAsync(Common.Instance.ApiCommonGetAllPropertyLocationSearch); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <List <PropertyLocationSearchResponse> >(); readTask.Wait(); vModel.PropertyLocationSearchList = readTask.Result; } //Get Type responseTask = client.GetAsync(Common.Instance.ApiCommonGetAllPropertyTypeSearch); responseTask.Wait(); result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <List <PropertyTypeSearchResponse> >(); readTask.Wait(); vModel.PropertyTypeSearchList = readTask.Result; } //Get Level responseTask = client.GetAsync(Common.Instance.ApiCommonGetAllPropertyLevelSearch); responseTask.Wait(); result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <List <PropertyLevelSearchResponse> >(); readTask.Wait(); vModel.PropertyLevelSearchList = readTask.Result; } //Get Lister responseTask = client.GetAsync(Common.Instance.ApiCommonGetAllPropertyListerSearch); responseTask.Wait(); result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <List <PropertyListerSearchResponse> >(); readTask.Wait(); vModel.PropertyListerSearchList = readTask.Result; } } using (var client = new HttpClient()) { client.BaseAddress = new Uri(Common.Instance.ApiFilterControllerName); var responseTask = client.GetAsync(Common.Instance.ApiFilterGetListingByLocation + "/" + Location.ToString()); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <List <PropertyDetailResponse> >(); readTask.Wait(); vModel.PropertyDetailSearchList = readTask.Result; } } //return Json(vModel); return(PartialView("_PropertyFilterListPartialView", vModel)); }