示例#1
0
 public ActionResult GetAlbumsForm(string q)
 {
     //uso mustage
     MusicStoreEntities db = new MusicStoreEntities();
     var albums = db.Albums.Where(a => a.Title.Contains(q)).ToList().Take(5);
     return Json(albums, JsonRequestBehavior.AllowGet);
 }
示例#2
0
 public ActionResult ArtistSearchNEW(string q)
 {
     //uso mustage
     MusicStoreEntities db = new MusicStoreEntities();
     var artists = db.Artists.Where(a => a.Name.Contains(q)).ToList();
     return Json(artists, JsonRequestBehavior.AllowGet);
 }
示例#3
0
 public ActionResult ArtistSearch(string q)
 {
     //vista parcial
     MusicStoreEntities db = new MusicStoreEntities();
     var artists = db.Artists.Where(a=>a.Name.Contains(q)).ToList();
     return PartialView("ArtistSearch",artists);
 }
示例#4
0
        public ActionResult GetAlbumsScroll(string q, int Id)
        {
            //uso mustage
            MusicStoreEntities db = new MusicStoreEntities();
            var albums = db.Albums.Where(a => a.Title.Contains(q) && a.Id>Id).ToList().Take(5);
            if (albums.Count()==0)
                return Json(null, JsonRequestBehavior.AllowGet);

            return Json(albums, JsonRequestBehavior.AllowGet);
        }
示例#5
0
 public JsonResult AlbumsList(string Id)
 {
     using (MusicStoreEntities db = new MusicStoreEntities())
     {
         List<Album> Albums = (from a in db.Albums.Include("Artist")
                               where a.Title.Contains(Id)
                               orderby a.Id ascending select a).ToList();
         return Json(Albums, JsonRequestBehavior.AllowGet);
     }
 }
示例#6
0
 public string About(Album album)
 {
     using (MusicStoreEntities db = new MusicStoreEntities())
     {
         if(album!=null)
             return "Thank you " + album.Title + ". Record Saved.";
         else
             return "Please complete the form.";
     }
 }
示例#7
0
 public ActionResult About()
 {
     using (MusicStoreEntities db = new MusicStoreEntities())
     {
         ViewBag.Albums = (from r in db.Albums.Include("Artist").Include("Genre") select r.Title).ToList();
         ViewBag.Genre = (from r in db.Genres select r.Name).ToList();
         ViewBag.Artist = (from r in db.Artists select r.Name).ToList();
         return View();
     }
 }
示例#8
0
 public ActionResult DailyDeal()
 {
     MusicStoreEntities db = new MusicStoreEntities();
     var album = db.Albums.Include("Artist").OrderBy(a => a.Price).First();
     return PartialView("_DailyDeal", album);
 }
示例#9
0
 public ActionResult Siguiente(int Inicio, int Fin)
 {
     using(MusicStoreEntities db = new MusicStoreEntities())
     {
         List<Album> Albums = (from a in db.Albums orderby a.Id ascending select a).Take(Fin).ToList();
         Albums.RemoveRange(0, Inicio - 1);
         return View(Albums);
     }
 }
示例#10
0
 public ActionResult QuickSearch(string term)
 {
     MusicStoreEntities db = new MusicStoreEntities();
     var artists = db.Artists.Where(a => a.Name.Contains(term)).ToList().Select(a => new { value = a.Name });
     return Json(artists, JsonRequestBehavior.AllowGet);
 }
示例#11
0
        public ActionResult Index()
        {
            ViewBag.Message = "Modifique esta plantilla para poner en marcha su aplicación ASP.NET MVC.";
            MusicStoreEntities db = new MusicStoreEntities();
            ViewBag.Inicio = 50; ViewBag.Fin = 100; // Siguiente en la lista

            try
               {
                   ViewBag.Albums = (from a in db.Albums
                                     orderby a.Id ascending
                                     select a).Take(50).ToList();
               }
               catch (Exception ex)
               {
                   log.Debug("Debug error logging", ex);
                   log.Info("Info error logging", ex);
                   log.Warn("Warn error logging", ex);
                   log.Error("Error error logging", ex);
                   log.Fatal("Fatal error logging", ex);
               }
            return View();
        }