public async Task <ActionResult> Exhibits(string id = "") { try { var exhibits = await _everlive.All <ExhibitViewModel>("Exhibit"); //tag matching if (!string.IsNullOrWhiteSpace(id)) { var artifacts = await _everlive.All <ArtifactViewModel>("Artifact", string.Format("{{ \"Tag\": \"{0}\"}}", id)); exhibits = exhibits.Where(e => artifacts.Any(a => a.ExihibitId == e.Id)); } foreach (var exhibit in exhibits) { exhibit.Artifacts = await _getExhibitArtifacts(exhibit.Id); exhibit.CreatedByUser = await _getUser(exhibit.CreatedBy); } return(View(exhibits)); } catch { return(RedirectToAction("Index")); } }
// GET api/values public async Task <IEnumerable <string> > Get() { _everlive = new EverliveRestClient(new HttpRestClient.HttpRestClient()); var tags = await _everlive.All <ArtifactViewModel>("Artifact", fields : "{ \"Tag\": 1 }"); return(tags.Select(e => e.Tag).Distinct()); }
// GET api/values public async Task<IEnumerable<string>> Get() { _everlive = new EverliveRestClient(new HttpRestClient.HttpRestClient()); var tags = await _everlive.All<ArtifactViewModel>("Artifact", fields: "{ \"Tag\": 1 }"); return tags.Select(e => e.Tag).Distinct(); }