public ActionResult Index() { var snippets = _snippetService.GetSnippets(); var snippetsVM = Mapper.Map <IEnumerable <Snippet>, IEnumerable <SnippetViewModel> >(snippets); return(View(snippetsVM)); }
public JsonResult SearchGroup(string term) { List <string> availableGroups = _snippetService.GetSnippets().Select(s => s.GroupName).Distinct().ToList(); List <string> matchedGroups = availableGroups.FindAll(x => x.StartsWith(term, StringComparison.OrdinalIgnoreCase)); return(Json(matchedGroups, JsonRequestBehavior.AllowGet)); }
public ActionResult <List <Snippet> > GetAllSnippets() { var snippets = _snippetService.GetSnippets(); if (snippets.Count == 0) { return(NoContent()); } return(Ok(snippets)); }