public string AddSongComment([FromBody] object json) { JObject j = JObject.Parse(json.ToString()); //获取评论内容 string sid = j["sid"].ToString(); string pid = j["pid"].ToString(); string content = j["content"].ToString(); string from = j["from"].ToString(); string to = j["to"].ToString(); SongComment c = new SongComment(); if (sid != "") { c.SC_Song = int.Parse(sid); } else { return("参数不完整"); } if (pid != "") { c.SC_Pid = int.Parse(pid); } if (content != "") { c.SC_Content = content; } else { return("参数不完整"); } if (from != "") { c.SC_From_User = int.Parse(from); } else { return("参数不完整"); } if (to != "") { c.SC_To_User = int.Parse(to); } else { c.SC_To_User = int.Parse(from); } c.SC_UpTime = DateTime.Now; return(SongCommentService.AddSongComment(c)); }
public List <CommModel> GetSongComment(int id) { var comm = SongCommentService.SelCommentBySongID(id); return(comm); }