日期:2014-05-17 浏览次数:20514 次
namespace MVCMusicStore.Models
{
public class Album //专辑
{
public virtual int AlbumId { get; set; }
public virtual int GenreID { get; set; }
public virtual int ArtistId { get; set; }
[StringLength(50)]
public virtual string Title { get; set; }
public virtual decimal Price { get; set; }
[StringLength(100)]
public virtual string AlbumArtUrl { get; set; }
public virtual Genre Genre { get; set; }
public virtual Artist Artist { get; set; }
}
public class Artist //艺术家
{
public virtual int ArtistId { get; set; }
public virtual int addressId { get; set; }
public virtual string Name { get; set; }
public virtual address address { get; set; }
}
public class address //地址
{
public virtual int addressId { get; set; }
public virtual string addressName { get; set; }
}
public class Genre //[电影]类型片大赏(风格)
{
public virtual int GenreId { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
//public virtual List<Album> Albums { get; set; }
}
}
public JsonResult getSku()
{
db.Configuration.ProxyCreationEnabled = false;
var result = db.Albums.Include(a => a.Artist).Include(a => a.Genre).Include(a => a.Artist.address);
return Json(result, JsonRequestBehavior.AllowGet);