public void CrawlTheData() { _documentStore = new DocumentStore { Url = ConfigSettings.Singleton().GetDatabaseUrl(), DefaultDatabase = ConfigSettings.Singleton().GetDatabaseName() }; _documentStore.Initialize(); // Add headers to file _dumpFile.SaveHeaders(); // Add data to file var sightingsQuery = new SightingsQueryInput() { Page = 1, NeedsId = false, PageSize = 100 }; //_dumpFile.SavePagedObjects(RunQuery(sightingsQuery)); while (_anyMoreRecords) { _dumpFile.SavePagedObjects(RunQuery(sightingsQuery)); sightingsQuery.Page++; } }
public object BuildGroupSightingList(string groupId, SightingsQueryInput sightingsQueryInput) { Check.RequireNotNullOrWhitespace(groupId, "groupId"); Check.RequireNotNull(sightingsQueryInput, "sightingsQueryInput"); return ExecuteQuery(sightingsQueryInput, new[] { groupId }); }
public object BuildGroupSightingList(string groupId, SightingsQueryInput sightingsQueryInput) { Check.RequireNotNullOrWhitespace(groupId, "groupId"); Check.RequireNotNull(sightingsQueryInput, "sightingsQueryInput"); return(ExecuteQuery(sightingsQueryInput, new[] { groupId })); }
public object BuildHomeSightingList(string userId, SightingsQueryInput sightingsQueryInput) { Check.RequireNotNullOrWhitespace(userId, "userId"); Check.RequireNotNull(sightingsQueryInput, "sightingsQueryInput"); var groupIds = _documentSession .Load <User>(userId) .Memberships.Select(x => x.Group.Id); return(ExecuteQuery(sightingsQueryInput, groupIds)); }
public ActionResult PublicIndex() { var sightingQueryInput = new SightingsQueryInput { Sort = "popular", Page = 1, PageSize = 20 }; dynamic viewModel = new ExpandoObject(); viewModel.HomeHeader = true; viewModel.Sightings = viewModel.Sightings = _sightingViewModelQuery.BuildSightingList(sightingQueryInput); return(RestfulResult( viewModel, "home", "publicindex")); }
private PagedList <string> RunQuery(SightingsQueryInput sightingsQueryInput) { using (var session = _documentStore.OpenSession()) { RavenQueryStatistics stats; var result = session.Query <Observation>() .Statistics(out stats) .Where(x => x.Identifications.Any() && x.Media.Any(y => y.MediaResource.MediaResourceType == "image")) .Skip(sightingsQueryInput.GetSkipIndex()) .Take(sightingsQueryInput.GetPageSize()) .ToList() .Select(Transformer.MakeSighting) .ToPagedList( sightingsQueryInput.GetPage(), sightingsQueryInput.GetPageSize(), stats.TotalResults ); _anyMoreRecords = result.PagedListItems.Any(); return(result); } }
public ActionResult List(SightingsQueryInput queryInput) { if (queryInput.View.ToLower() == "thumbnails") { queryInput.PageSize = 15; } if (queryInput.View.ToLower() == "details") { queryInput.PageSize = 10; } if (string.IsNullOrWhiteSpace(queryInput.Sort) || (queryInput.Sort.ToLower() != "newest" && queryInput.Sort.ToLower() != "oldest" && queryInput.Sort.ToLower() != "a-z" && queryInput.Sort.ToLower() != "z-a")) { queryInput.Sort = "newest"; } queryInput.Category = queryInput.Category ?? string.Empty; if (!string.IsNullOrWhiteSpace(queryInput.Category) && !Categories.IsValidCategory(queryInput.Category)) { queryInput.Category = string.Empty; } queryInput.Query = queryInput.Query ?? string.Empty; queryInput.Field = queryInput.Field ?? string.Empty; queryInput.Taxonomy = queryInput.Taxonomy ?? string.Empty; dynamic viewModel = new ExpandoObject(); viewModel.Sightings = _sightingViewModelQuery.BuildSightingList(queryInput); viewModel.CategorySelectList = Categories.GetSelectList(queryInput.Category); viewModel.Categories = Categories.GetAll(); viewModel.Query = new { queryInput.Page, queryInput.PageSize, queryInput.Sort, queryInput.View, queryInput.Category, queryInput.NeedsId, queryInput.Query, queryInput.Field, queryInput.Taxonomy, IsThumbnailsView = queryInput.View == "thumbnails", IsDetailsView = queryInput.View == "details", IsMapView = queryInput.View == "map" }; viewModel.ShowSightings = true; viewModel.FieldSelectList = new[] { new { Text = "Sighting Title", Value = "title", Selected = queryInput.Field.ToLower() == "title" }, new { Text = "Descriptions", Value = "descriptions", Selected = queryInput.Field.ToLower() == "descriptions" }, new { Text = "Tags", Value = "tags", Selected = queryInput.Field.ToLower() == "tags" }, new { Text = "Scientific Name", Value = "scientificname", Selected = queryInput.Field.ToLower() == "scientificname" }, new { Text = "Common Name", Value = "commonname", Selected = queryInput.Field.ToLower() == "commonname" } }; return(RestfulResult( viewModel, "sightings", "list")); }
public ActionResult Favourites(SightingsQueryInput queryInput) { var userResult = _documentSession .Query <All_Users.Result, All_Users>() .AsProjection <All_Users.Result>() .Where(x => x.UserId == _userContext.GetAuthenticatedUserId()) .Single(); if (queryInput.View.ToLower() == "thumbnails") { queryInput.PageSize = 15; } if (queryInput.View.ToLower() == "details") { queryInput.PageSize = 10; } if (string.IsNullOrWhiteSpace(queryInput.Sort) || (queryInput.Sort.ToLower() != "newest" && queryInput.Sort.ToLower() != "oldest" && queryInput.Sort.ToLower() != "a-z" && queryInput.Sort.ToLower() != "z-a")) { queryInput.Sort = "newest"; } queryInput.Category = queryInput.Category ?? string.Empty; if (!string.IsNullOrWhiteSpace(queryInput.Category) && !Categories.IsValidCategory(queryInput.Category)) { queryInput.Category = string.Empty; } queryInput.Query = queryInput.Query ?? string.Empty; queryInput.Field = queryInput.Field ?? string.Empty; queryInput.Taxonomy = queryInput.Taxonomy ?? string.Empty; dynamic viewModel = new ExpandoObject(); viewModel.User = _userViewModelQuery.BuildUser(_userContext.GetAuthenticatedUserId()); viewModel.Sightings = _sightingViewModelQuery.BuildGroupSightingList(userResult.User.Favourites.Id, queryInput); viewModel.CategorySelectList = Categories.GetSelectList(queryInput.Category); viewModel.IsFavourites = true; viewModel.Query = new { queryInput.Page, queryInput.PageSize, queryInput.Sort, queryInput.View, queryInput.Category, queryInput.NeedsId, queryInput.Query, queryInput.Field, queryInput.Taxonomy, IsThumbnailsView = queryInput.View == "thumbnails", IsDetailsView = queryInput.View == "details", IsMapView = queryInput.View == "map" }; viewModel.ShowSightings = true; viewModel.FieldSelectList = new[] { new { Text = "Sighting Title", Value = "title", Selected = queryInput.Field.ToLower() == "title" }, new { Text = "Descriptions", Value = "descriptions", Selected = queryInput.Field.ToLower() == "descriptions" }, new { Text = "Tags", Value = "tags", Selected = queryInput.Field.ToLower() == "tags" }, new { Text = "Scientific Name", Value = "scientificname", Selected = queryInput.Field.ToLower() == "scientificname" }, new { Text = "Common Name", Value = "commonname", Selected = queryInput.Field.ToLower() == "commonname" } }; return(RestfulResult( viewModel, "home", "favourites")); }
private object ExecuteQuery(SightingsQueryInput sightingsQueryInput, IEnumerable <string> groupIds) { RavenQueryStatistics stats; User authenticatedUser = null; if (_userContext.IsUserAuthenticated()) { authenticatedUser = _documentSession.Load <User>(_userContext.GetAuthenticatedUserId()); } var query = _documentSession .Advanced .LuceneQuery <All_Contributions.Result, All_Contributions>() .Statistics(out stats) .SelectFields <All_Contributions.Result>("GroupIds", "CreatedDateTime", "ParentContributionId", "SubContributionId", "ParentContributionType", "SubContributionType", "UserId", "Observation", "Record", "Post", "User") .WhereIn("ParentContributionType", new[] { "observation", "record" }) .AndAlso() .WhereEquals("SubContributionType", null); if (groupIds.Any()) { query = query .AndAlso() .WhereIn("GroupIds", groupIds); } if (!string.IsNullOrWhiteSpace(sightingsQueryInput.Category)) { query = query .AndAlso() .WhereEquals("SightingCategory", sightingsQueryInput.Category); } if (sightingsQueryInput.NeedsId) { query = query .AndAlso() .WhereEquals("SightingIdentificationCount", 0); } if (!string.IsNullOrWhiteSpace(sightingsQueryInput.Query)) { var field = "SightingAllFields"; if (sightingsQueryInput.Field.ToLower() == "title") { field = "SightingTitle"; } if (sightingsQueryInput.Field.ToLower() == "descriptions") { field = "SightingDescriptions"; } if (sightingsQueryInput.Field.ToLower() == "tags") { field = "SightingTags"; } query = query .AndAlso() .Search(field, sightingsQueryInput.Query); } if (!string.IsNullOrWhiteSpace(sightingsQueryInput.Taxonomy)) { var ranks = sightingsQueryInput.Taxonomy.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries); foreach (var rank in ranks) { query = query .AndAlso() .Search("SightingTaxonomicRanks", rank); } } switch (sightingsQueryInput.Sort.ToLower()) { default: case "newest": query = query.AddOrder(x => x.CreatedDateTime, true); break; case "oldest": query = query.AddOrder(x => x.CreatedDateTime, false); break; case "a-z": query = query.AddOrder(x => x.SightingSortTitle, false); break; case "z-a": query = query.AddOrder(x => x.SightingSortTitle, true); break; case "popular": query = query.AddOrder(x => x.SightingVoteCount, true); break; //case "active": // Having most activity // break; //case "needsid": // Needs an identification // break; } return(query .Skip(sightingsQueryInput.GetSkipIndex()) .Take(sightingsQueryInput.GetPageSize()) .ToList() .Select(x => _sightingViewFactory.Make(x.Contribution as Sighting, x.User, x.Groups, authenticatedUser)) .ToPagedList( sightingsQueryInput.GetPage(), sightingsQueryInput.GetPageSize(), stats.TotalResults )); }
private object ExecuteQuery(SightingsQueryInput sightingsQueryInput, IEnumerable<string> groupIds) { RavenQueryStatistics stats; User authenticatedUser = null; if (_userContext.IsUserAuthenticated()) { authenticatedUser = _documentSession.Load<User>(_userContext.GetAuthenticatedUserId()); } var query = _documentSession .Advanced .LuceneQuery<All_Contributions.Result, All_Contributions>() .Statistics(out stats) .SelectFields<All_Contributions.Result>("GroupIds", "CreatedDateTime", "ParentContributionId", "SubContributionId", "ParentContributionType", "SubContributionType", "UserId", "Observation", "Record", "Post", "User") .WhereIn("ParentContributionType", new[] { "observation", "record" }) .AndAlso() .WhereEquals("SubContributionType", null); if (groupIds.Any()) { query = query .AndAlso() .WhereIn("GroupIds", groupIds); } if (!string.IsNullOrWhiteSpace(sightingsQueryInput.Category)) { query = query .AndAlso() .WhereEquals("SightingCategory", sightingsQueryInput.Category); } if (sightingsQueryInput.NeedsId) { query = query .AndAlso() .WhereEquals("SightingIdentificationCount", 0); } if (!string.IsNullOrWhiteSpace(sightingsQueryInput.Query)) { var field = "SightingAllFields"; if (sightingsQueryInput.Field.ToLower() == "title") { field = "SightingTitle"; } if (sightingsQueryInput.Field.ToLower() == "descriptions") { field = "SightingDescriptions"; } if (sightingsQueryInput.Field.ToLower() == "tags") { field = "SightingTags"; } query = query .AndAlso() .Search(field, sightingsQueryInput.Query); } if (!string.IsNullOrWhiteSpace(sightingsQueryInput.Taxonomy)) { var ranks = sightingsQueryInput.Taxonomy.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries); foreach (var rank in ranks) { query = query .AndAlso() .Search("SightingTaxonomicRanks", rank); } } switch (sightingsQueryInput.Sort.ToLower()) { default: case "newest": query = query.AddOrder(x => x.CreatedDateTime, true); break; case "oldest": query = query.AddOrder(x => x.CreatedDateTime, false); break; case "a-z": query = query.AddOrder(x => x.SightingSortTitle, false); break; case "z-a": query = query.AddOrder(x => x.SightingSortTitle, true); break; case "popular": query = query.AddOrder(x => x.SightingVoteCount, true); break; //case "active": // Having most activity // break; //case "needsid": // Needs an identification // break; } return query .Skip(sightingsQueryInput.GetSkipIndex()) .Take(sightingsQueryInput.GetPageSize()) .ToList() .Select(x => _sightingViewFactory.Make(x.Contribution as Sighting, x.User, x.Groups, authenticatedUser)) .ToPagedList( sightingsQueryInput.GetPage(), sightingsQueryInput.GetPageSize(), stats.TotalResults ); }
public object BuildSightingList(SightingsQueryInput sightingsQueryInput) { Check.RequireNotNull(sightingsQueryInput, "sightingsQueryInput"); return(ExecuteQuery(sightingsQueryInput, new string[] { })); }
public ActionResult Favourites(SightingsQueryInput queryInput) { var userResult = _documentSession .Query<All_Users.Result, All_Users>() .AsProjection<All_Users.Result>() .Where(x => x.UserId == _userContext.GetAuthenticatedUserId()) .Single(); if (queryInput.View.ToLower() == "thumbnails") { queryInput.PageSize = 15; } if (queryInput.View.ToLower() == "details") { queryInput.PageSize = 10; } if (string.IsNullOrWhiteSpace(queryInput.Sort) || (queryInput.Sort.ToLower() != "newest" && queryInput.Sort.ToLower() != "oldest" && queryInput.Sort.ToLower() != "a-z" && queryInput.Sort.ToLower() != "z-a")) { queryInput.Sort = "newest"; } queryInput.Category = queryInput.Category ?? string.Empty; if (!string.IsNullOrWhiteSpace(queryInput.Category) && !Categories.IsValidCategory(queryInput.Category)) { queryInput.Category = string.Empty; } queryInput.Query = queryInput.Query ?? string.Empty; queryInput.Field = queryInput.Field ?? string.Empty; queryInput.Taxonomy = queryInput.Taxonomy ?? string.Empty; dynamic viewModel = new ExpandoObject(); viewModel.User = _userViewModelQuery.BuildUser(_userContext.GetAuthenticatedUserId()); viewModel.Sightings = _sightingViewModelQuery.BuildGroupSightingList(userResult.User.Favourites.Id, queryInput); viewModel.CategorySelectList = Categories.GetSelectList(queryInput.Category); viewModel.IsFavourites = true; viewModel.Query = new { queryInput.Page, queryInput.PageSize, queryInput.Sort, queryInput.View, queryInput.Category, queryInput.NeedsId, queryInput.Query, queryInput.Field, queryInput.Taxonomy, IsThumbnailsView = queryInput.View == "thumbnails", IsDetailsView = queryInput.View == "details", IsMapView = queryInput.View == "map" }; viewModel.ShowSightings = true; viewModel.FieldSelectList = new[] { new { Text = "Sighting Title", Value = "title", Selected = queryInput.Field.ToLower() == "title" }, new { Text = "Descriptions", Value = "descriptions", Selected = queryInput.Field.ToLower() == "descriptions" }, new { Text = "Tags", Value = "tags", Selected = queryInput.Field.ToLower() == "tags" }, new { Text = "Scientific Name", Value = "scientificname", Selected = queryInput.Field.ToLower() == "scientificname" }, new { Text = "Common Name", Value = "commonname", Selected = queryInput.Field.ToLower() == "commonname" } }; return RestfulResult( viewModel, "home", "favourites"); }
public ActionResult Sightings(SightingsQueryInput queryInput) { var userResult = _documentSession .Query<All_Users.Result, All_Users>() .AsProjection<All_Users.Result>() .Where(x => x.UserId == _userContext.GetAuthenticatedUserId()) .First(); if (queryInput.View.ToLower() == "thumbnails") { queryInput.PageSize = 15; } if (queryInput.View.ToLower() == "details") { queryInput.PageSize = 10; } if (string.IsNullOrWhiteSpace(queryInput.Sort) || (queryInput.Sort.ToLower() != "newest" && queryInput.Sort.ToLower() != "oldest" && queryInput.Sort.ToLower() != "a-z" && queryInput.Sort.ToLower() != "z-a") && queryInput.Sort.ToLower() != "popular") { queryInput.Sort = "newest"; } queryInput.Category = queryInput.Category ?? string.Empty; if (!string.IsNullOrWhiteSpace(queryInput.Category) && !Categories.IsValidCategory(queryInput.Category)) { queryInput.Category = string.Empty; } queryInput.Query = queryInput.Query ?? string.Empty; queryInput.Field = queryInput.Field ?? string.Empty; queryInput.Taxonomy = queryInput.Taxonomy ?? string.Empty; dynamic viewModel = new ExpandoObject(); viewModel.User = _userViewModelQuery.BuildUser(_userContext.GetAuthenticatedUserId()); viewModel.Sightings = _sightingViewModelQuery.BuildHomeSightingList(_userContext.GetAuthenticatedUserId(), queryInput); viewModel.CategorySelectList = Categories.GetSelectList(queryInput.Category); viewModel.Query = new { Id = "home", // We set the id to home, so that the mustache sightings list creates correct sorting URL queryInput.Page, queryInput.PageSize, queryInput.Sort, queryInput.View, queryInput.Category, queryInput.NeedsId, queryInput.Query, queryInput.Field, queryInput.Taxonomy, IsThumbnailsView = queryInput.View == "thumbnails", IsDetailsView = queryInput.View == "details", IsMapView = queryInput.View == "map" }; viewModel.ShowUserWelcome = userResult.User.CallsToAction.Contains("user-welcome"); viewModel.ShowSightings = true; viewModel.FieldSelectList = new[] { new { Text = "Sighting Title", Value = "title", Selected = queryInput.Field.ToLower() == "title" }, new { Text = "Descriptions", Value = "descriptions", Selected = queryInput.Field.ToLower() == "descriptions" }, new { Text = "Tags", Value = "tags", Selected = queryInput.Field.ToLower() == "tags" }, new { Text = "Scientific Name", Value = "scientificname", Selected = queryInput.Field.ToLower() == "scientificname" }, new { Text = "Common Name", Value = "commonname", Selected = queryInput.Field.ToLower() == "commonname" } }; return RestfulResult( viewModel, "home", "sightings"); }
public ActionResult PublicIndex() { var sightingQueryInput = new SightingsQueryInput { Sort = "popular", Page = 1, PageSize = 20 }; dynamic viewModel = new ExpandoObject(); viewModel.HomeHeader = true; viewModel.Sightings = viewModel.Sightings = _sightingViewModelQuery.BuildSightingList(sightingQueryInput); return RestfulResult( viewModel, "home", "publicindex"); }
public object BuildHomeSightingList(string userId, SightingsQueryInput sightingsQueryInput) { Check.RequireNotNullOrWhitespace(userId, "userId"); Check.RequireNotNull(sightingsQueryInput, "sightingsQueryInput"); var groupIds = _documentSession .Load<User>(userId) .Memberships.Select(x => x.Group.Id); return ExecuteQuery(sightingsQueryInput, groupIds); }
public ActionResult Sightings(string id, SightingsQueryInput queryInput) { string userId = VerbosifyId<User>(id); if (!_permissionManager.DoesExist<User>(userId)) { return HttpNotFound(); } if (queryInput.View.ToLower() == "thumbnails") { queryInput.PageSize = 15; } if (queryInput.View.ToLower() == "details") { queryInput.PageSize = 10; } if (string.IsNullOrWhiteSpace(queryInput.Sort) || (queryInput.Sort.ToLower() != "a-z" && queryInput.Sort.ToLower() != "z-a")) { queryInput.Sort = "newest"; } queryInput.Category = queryInput.Category ?? string.Empty; if (!string.IsNullOrWhiteSpace(queryInput.Category) && !Categories.IsValidCategory(queryInput.Category)) { queryInput.Category = string.Empty; } queryInput.Query = queryInput.Query ?? string.Empty; queryInput.Field = queryInput.Field ?? string.Empty; queryInput.Taxonomy = queryInput.Taxonomy ?? string.Empty; var userResult = _documentSession .Query<All_Users.Result, All_Users>() .Where(x => x.UserId == userId) .First(); dynamic viewModel = new ExpandoObject(); viewModel.User = _userViewModelQuery.BuildUser(userId); viewModel.Sightings = _sightingViewModelQuery.BuildGroupSightingList(userResult.User.UserProject.Id, queryInput); viewModel.SightingCountDescription = "Sighting" + (userResult.SightingCount == 1 ? string.Empty : "s"); viewModel.ProjectCountDescription = "Project" + (userResult.Projects.Count() == 1 ? string.Empty : "s"); viewModel.OrganisationCountDescription = "Organisation" + (userResult.Organisations.Count() == 1 ? string.Empty : "s"); viewModel.CategorySelectList = Categories.GetSelectList(queryInput.Category); viewModel.Query = new { Id = userId, queryInput.Page, queryInput.PageSize, queryInput.Sort, queryInput.View, queryInput.Category, queryInput.NeedsId, queryInput.Query, queryInput.Field, queryInput.Taxonomy, IsThumbnailsView = queryInput.View == "thumbnails", IsDetailsView = queryInput.View == "details", IsMapView = queryInput.View == "map" }; viewModel.ShowSightings = true; viewModel.FieldSelectList = new[] { new { Text = "Sighting Title", Value = "title", Selected = queryInput.Field.ToLower() == "title" }, new { Text = "Descriptions", Value = "descriptions", Selected = queryInput.Field.ToLower() == "descriptions" }, new { Text = "Tags", Value = "tags", Selected = queryInput.Field.ToLower() == "tags" }, new { Text = "Scientific Name", Value = "scientificname", Selected = queryInput.Field.ToLower() == "scientificname" }, new { Text = "Common Name", Value = "commonname", Selected = queryInput.Field.ToLower() == "commonname" } }; return RestfulResult( viewModel, "users", "sightings"); }
public ActionResult Sightings(string id, SightingsQueryInput queryInput) { string projectId = VerbosifyId <Project>(id); if (!_permissionManager.DoesExist <Project>(projectId)) { return(HttpNotFound()); } if (queryInput.View.ToLower() == "thumbnails") { queryInput.PageSize = 15; } if (queryInput.View.ToLower() == "details") { queryInput.PageSize = 10; } if (string.IsNullOrWhiteSpace(queryInput.Sort) || (queryInput.Sort.ToLower() != "newest" && queryInput.Sort.ToLower() != "oldest" && queryInput.Sort.ToLower() != "a-z" && queryInput.Sort.ToLower() != "z-a")) { queryInput.Sort = "newest"; } queryInput.Category = queryInput.Category ?? string.Empty; if (!string.IsNullOrWhiteSpace(queryInput.Category) && !Categories.IsValidCategory(queryInput.Category)) { queryInput.Category = string.Empty; } queryInput.Query = queryInput.Query ?? string.Empty; queryInput.Field = queryInput.Field ?? string.Empty; queryInput.Taxonomy = queryInput.Taxonomy ?? string.Empty; var projectResult = _documentSession .Query <All_Groups.Result, All_Groups>() .AsProjection <All_Groups.Result>() .Where(x => x.GroupId == projectId) .First(); dynamic viewModel = new ExpandoObject(); viewModel.Project = _projectViewModelQuery.BuildProject(projectId); viewModel.Sightings = _sightingViewModelQuery.BuildGroupSightingList(projectId, queryInput); viewModel.UserCountDescription = "Member" + (projectResult.UserCount == 1 ? string.Empty : "s"); viewModel.SightingCountDescription = "Sighting" + (projectResult.SightingCount == 1 ? string.Empty : "s"); viewModel.PostCountDescription = "Post" + (projectResult.PostCount == 1 ? string.Empty : "s"); viewModel.CategorySelectList = Categories.GetSelectList(queryInput.Category); viewModel.Categories = Categories.GetAll(); viewModel.Query = new { Id = projectId, queryInput.Page, queryInput.PageSize, queryInput.Sort, queryInput.View, queryInput.Category, queryInput.NeedsId, queryInput.Query, queryInput.Field, queryInput.Taxonomy, IsThumbnailsView = queryInput.View == "thumbnails", IsDetailsView = queryInput.View == "details", IsMapView = queryInput.View == "map" }; viewModel.ShowSightings = true; viewModel.FieldSelectList = new[] { new { Text = "Sighting Title", Value = "title", Selected = queryInput.Field.ToLower() == "title" }, new { Text = "Descriptions", Value = "descriptions", Selected = queryInput.Field.ToLower() == "descriptions" }, new { Text = "Tags", Value = "tags", Selected = queryInput.Field.ToLower() == "tags" }, new { Text = "Scientific Name", Value = "scientificname", Selected = queryInput.Field.ToLower() == "scientificname" }, new { Text = "Common Name", Value = "commonname", Selected = queryInput.Field.ToLower() == "commonname" } }; return(RestfulResult( viewModel, "projects", "sightings")); }
public object BuildSightingList(SightingsQueryInput sightingsQueryInput) { Check.RequireNotNull(sightingsQueryInput, "sightingsQueryInput"); return ExecuteQuery(sightingsQueryInput, new string[] { }); }