Ejemplo n.º 1
0
 public TabModel Execute(int tabID)
 {
     return(_db.FindBy(t => t.Id == tabID).Select(t => new TabModel()
     {
         Artist = t.Artist,
         Author = t.Author,
         FileName = t.FileName,
         Id = t.Id,
         IsApproved = t.IsApproved,
         Style = t.Style,
         Tags = t.Tags,
         Title = t.Title,
         Alias = _stringService.GenerateSlug(t.Title)
     }).FirstOrDefault());
 }
        List <TabModel> IGetTabsListLastQuery.Execute(int top)
        {
            var tabs = _db.FindBy(t => t.IsApproved).OrderByDescending(t => t.Id).Take(top).Select(t => new TabModel()
            {
                Id         = t.Id,
                Title      = t.Title,
                Artist     = t.Artist,
                Author     = t.Author,
                FileName   = t.FileName,
                Style      = t.Style,
                Tags       = t.Tags,
                IsApproved = t.IsApproved,
                Alias      = _stringService.GenerateSlug(t.Title)
            });

            return(tabs.ToList());
        }
        public List <TabModel> Execute(string artist)
        {
            artist = artist.Replace("-", " ");
            var tabs = _db.FindBy(t => t.Artist.ToUpper().Contains(artist.ToUpper()) && t.IsApproved).Select(t => new TabModel()
            {
                Id         = t.Id,
                Title      = t.Title,
                Artist     = t.Artist,
                Author     = t.Author,
                FileName   = t.FileName,
                Style      = t.Style,
                Tags       = t.Tags,
                IsApproved = t.IsApproved,
                Alias      = _stringService.GenerateSlug(t.Title)
            });

            return(tabs.OrderBy(x => x.Title).ToList());
        }