Skip to content

Commit

Permalink
fixed place type search concept filters and dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
Nityan Khanna committed Feb 7, 2018
1 parent 9990972 commit f34fcc9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions OpenIZAdmin.Services/Entities/Places/IPlaceConceptService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ public interface IPlaceConceptService
/// </summary>
/// <returns>Returns a list of place type concepts.</returns>
IEnumerable<Concept> GetPlaceTypeConcepts();

/// <summary>
/// Gets the place sub type concepts.
/// </summary>
/// <returns>Returns a list of place type subconcepts.</returns>
IEnumerable<Concept> GetPlaceSubTypeConcepts();
}
}
9 changes: 9 additions & 0 deletions OpenIZAdmin.Services/Entities/Places/PlaceConceptService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,14 @@ public IEnumerable<Concept> GetPlaceTypeConcepts()
{
return this.cacheService.Get("PlaceTypeConcept", () => this.conceptService.GetConceptsByConceptSetMnemonic("PlaceTypeConcept"));
}

/// <summary>
/// Gets the place sub type concepts.
/// </summary>
/// <returns>Returns a list of place type subconcepts.</returns>
public IEnumerable<Concept> GetPlaceSubTypeConcepts()
{
return this.cacheService.Get("PlaceTypes", () => this.conceptService.GetConceptsByConceptSetMnemonic("PlaceTypes"));
}
}
}
15 changes: 15 additions & 0 deletions OpenIZAdmin/Controllers/PlaceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ public ActionResult Create()
// get the place type concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage()).ToList());

// get the place types sub concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceSubTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage()).ToList());

// order the type concept list
model.TypeConcepts = model.TypeConcepts.OrderBy(c => c.Text).ToList();
}
Expand Down Expand Up @@ -428,6 +431,9 @@ public ActionResult Create(CreatePlaceModel model)
// get the place type concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage()).ToList());

// get the place types sub concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceSubTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage()).ToList());

// order the type concept list
model.TypeConcepts = model.TypeConcepts.OrderBy(c => c.Text).ToList();

Expand Down Expand Up @@ -677,6 +683,9 @@ public ActionResult Edit(Guid id, Guid? versionId)
// get the place type concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage(), c => c.Key == place.TypeConceptKey).ToList());

// get the place types sub concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceSubTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage(), c => c.Key == place.TypeConceptKey).ToList());

// order the type concept list
model.TypeConcepts = model.TypeConcepts.OrderBy(c => c.Text).ToList();

Expand Down Expand Up @@ -738,6 +747,9 @@ public ActionResult Edit(EditPlaceModel model)
// get the place type concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage(), c => c.Key == place.TypeConceptKey).ToList());

// get the place types sub concepts
model.TypeConcepts.AddRange(this.placeConceptService.GetPlaceSubTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage(), c => c.Key == place.TypeConceptKey).ToList());

// order the type concept list
model.TypeConcepts = model.TypeConcepts.OrderBy(c => c.Text).ToList();

Expand Down Expand Up @@ -865,6 +877,9 @@ public ActionResult Index()
// get the place type concepts
typeFilter.AddRange(this.placeConceptService.GetPlaceTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage()).ToList());

// get the place types sub concepts
typeFilter.AddRange(this.placeConceptService.GetPlaceSubTypeConcepts().ToSelectList(this.HttpContext.GetCurrentLanguage()).ToList());

// order the type concept list
typeFilter = typeFilter.OrderBy(c => c.Text).ToList();
}
Expand Down

0 comments on commit f34fcc9

Please sign in to comment.