0

我想将一个动作用于另一个动作以获取一些值:

 [HttpPost]
        public ActionResult Playlist(PageInfo p, long ID)
        {
            //long playid=Convert.ToInt64(p.Where);
            var q = from client in my.Clients(0, 0)
                    join pl in db.Playlists on client.ClientId equals pl.ClientId
                    select new SimpleViewModel
                    {
                        Sequence=pl.PlaylistContentSequenceId,
                        PlaylistID = pl.PlaylistId,
                        PlaylistContentID=pl.ContentId
                    };
            return Json(q.ToPage(p, "Sequence"), JsonRequestBehavior.DenyGet);
        }

        [HttpPost]
        public ActionResult Save(List<ItemEditViewModel> data,long playlistid, List<long> deleted,string Title)
        {
            var playlist = db.Playlists.Include("PlaylistContents").FirstOrDefault(x => x.PlaylistId == playlistid);



            for (int i = 0; i < playlist.PlaylistContents.Count; i++)
            {
                if(deleted.IndexOf(playlist.PlaylistContents[i].PlaylistContentId)>-1){
                    playlist.PlaylistContents.Remove(playlist.PlaylistContents[i]);
                }
            }
            db.SaveChanges();
            long ID=playlistid;
            return Playlist(new PageInfo(),ID);

        }

正如您在代码中看到的,将内容保存到数据库后,应该使用播放列表控制器来返回 Json 数据。

4

1 回答 1

0

代替

return Playlist(new PageInfo(),ID);

尝试

return RedirectToAction("Playlist", new {p = new PageInfo(), ID = ID});
于 2013-05-07T18:47:37.967 回答