public string MusicUpLoad() { try { HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; //获取传统context HttpRequestBase request = context.Request; //定义传统request对象 //string resultUrl = Upload(request.Files[0], "Music"); SongList s = new SongList() { WYID = "", S_Name = request.Form["sname"].ToString(), S_Type = 1, //先上传文件 在添加到歌手表 S_Url = uri + Upload(request.Files[0], "Music"), S_Cover = uri + Upload(request.Files[1], "MusicCover"), //添加到数据库 这里直接接收返回的歌手id S_Singer = SongListService.AddSinger(UserInfoService.SelUserInfoByID(int.Parse(request.Form["uid"].ToString()))), S_PlayCount = 0, S_CollectCount = 0, S_UpTime = DateTime.Now, S_Lyric = "", S_Album = 0 }; if (SongListService.AddSongList(s)) { return("添加成功"); } return("添加失败"); } catch (Exception e) { return(e.Message); } }
public string AddCollectCount(int id) { if (SongListService.AddCount(id, 2)) { return("成功"); } else { return("失败"); } }
public Dictionary <string, object> SelSongMenuByID(int id) { Dictionary <string, object> dic = new Dictionary <string, object>(); var m = SongMenuService.SelSongMenuByID(id); if (m != null) { string songID = m.GetType().GetProperty("M_SongId").GetValue(m).ToString(); string[] songMenuNum = songID?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var song = SongListService.SelSongListByMenu(songMenuNum); dic.Add("songMenuInfo", m); dic.Add("songInfo", song); } return(dic); }
public object GetAlbumByID(int id) { Dictionary <string, object> dic = new Dictionary <string, object>(); var albun = AlbumService.GetAlbumByID(id); if (albun != null) { string songID = albun.GetType().GetProperty("A_Song").GetValue(albun).ToString(); string[] songMenuNum = songID?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var song = SongListService.SelSongListByMenu(songMenuNum); dic.Add("AlbumInfo", albun); dic.Add("SongList", song); } return(dic); }
public MainWindowViewModel(MediaElement mediaElement) { Songs.SongTags = new List <string>(); //Songs.PlayingSong = new Song(); //Songs.SongList = new List<Song>(); Songs.SelectedTags = new List <string>(); //Songs.PlayingSongs = new List<Song>(); //ControlService = new ControlService(); //TagsSelectService = new TagsSelectService(); TitleBarService = new TitleBarService(); SongListService = new SongListService(mediaElement); VisibilityService = new VisibilityService(); //PlayService = new PlayService(); }
public object Top8(int id) { int top = 10; if (id == 1) { //热门推荐 var list = SongListService.SelHotTop(top); return(list); } else if (id == 2) { //歌单 var list = SongListService.SelSongListTop(top); return(list); } return(null); }
public string AddSongList([FromBody] object json) { bool f = true; //解析json信息 JArray jar = (JArray)JsonConvert.DeserializeObject(json.ToString()); for (int i = 0; i < jar.Count; i++) { JObject j = JObject.Parse(jar[i].ToString()); SongList s = new SongList() { WYID = j["S_Id"].ToString(), S_Name = j["S_Name"].ToString(), S_Type = 1, //添加到数据库 这里直接接收返回的歌手id S_Singer = SongListService.AddSinger(j["S_Singer"].ToString()), S_Url = j["S_Url"].ToString(), S_Cover = j["S_Cover"].ToString(), S_PlayCount = 0, S_CollectCount = 0, S_UpTime = DateTime.Now, S_Lyric = "", S_Album = 0, }; if (!SongListService.AddSongList(s)) { f = false; } } if (f) { return("添加成功"); } else { return("添加失败"); } }
public object SelSongInfoByID(int id) { return(SongListService.SelSongbyID(id)); }
public object SelSongListALL(int top = 30, int page = 0) { return(SongListService.SelSongListALL(top, page)); }
public object SelSongListByType(int id, int top = 30, int page = 0) { return(SongListService.SelSongListByTypeID(id, top, page)); }
public object SelSongListByName(string name, int top = 30, int page = 0) { return(SongListService.SelSongListByName(name, top, page)); }
public Dictionary <string, object> SelRecentSong(int id, int length = 20) { return(SongListService.SelRecentSong(id, length)); }