Exemplo n.º 1
0
        public IActionResult Index()
        {
            var all = _repo.GetAll();

            // Do magic
            return(View(all.Select(s => new SnippetViewModel()
            {
                Snippet = s,
                SnippetFile = _fileService.ReadSnippet(s.Id)
            })));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public async Task <IEnumerable <Snippet> > GetSnippets()
 {
     return(await _repository.GetAll());
 }
Exemplo n.º 4
0
        public IEnumerable <Snippet> GetSnippets()
        {
            var snippets = snippetsRepository.GetAll();

            return(snippets);
        }