public IActionResult Index() { var all = _repo.GetAll(); // Do magic return(View(all.Select(s => new SnippetViewModel() { Snippet = s, SnippetFile = _fileService.ReadSnippet(s.Id) }))); }
public SnippetsViewModel() { _snippetRepository = new SnippetRepository(); _snippetService = new SnippetService(); Snippets = new ObservableCollection <Snippet>( _snippetRepository.GetAll()); _snippetService.ApplySnippets(Snippets); AddCommand = new DelegatingCommand(x => true, OnAdd); SaveCommand = new DelegatingCommand(x => true, OnSave); DeleteCommand = new DelegatingCommand(x => true, OnDelete); }
public async Task <IEnumerable <Snippet> > GetSnippets() { return(await _repository.GetAll()); }
public IEnumerable <Snippet> GetSnippets() { var snippets = snippetsRepository.GetAll(); return(snippets); }