Пример #1
0
 public ViewItem(string mode, Music music)
 {
     this.mode = mode;
     this.num = music.Seq;
     this.URL = music.URL;
     this.ChannelID = music.ChannelID;
     this.MusicID = music.MusicID;
     this.Title = music.Title;
 }
Пример #2
0
 public ViewItem(string mode, Channel channel, Music music, Member member)
 {
     this.mode = mode;
     this.num = music.Seq;
     this.URL = music.URL;
     this.ChannelID = music.ChannelID;
     this.MusicID = music.MusicID;
     this.Title = music.Title;
     this.Auth = false;
     this.Name = member.NickName;
     if (music.MemberID == member.MemberID)
     {
         this.Auth = true;
     }
     else
     {
         if (channel.CreateMemberID == member.MemberID)
         {
             this.Auth = true;
         }
     }
 }
Пример #3
0
        public JsonResult SeqDownProc(long MusicID)
        {
            bool chk = false;
            string msg = String.Empty;
            Music music = new Music();

            using (var context = new SharedPlayerContext())
            {
                music = context.Musics.Where(x => x.MusicID == MusicID).FirstOrDefault() ?? new Music();

                int num = music.Seq;

                Music nxtMusic = context.Musics.Where(x => x.ChannelID == music.ChannelID).Where(x => x.MusicID > music.MusicID).OrderBy(x => x.MusicID).FirstOrDefault();
                if (nxtMusic != null && nxtMusic.MusicID > 0)
                {
                    music.Seq = nxtMusic.Seq;
                    nxtMusic.Seq = num;
                    context.SaveChanges();
                    chk = true;
                    msg = "";
                }
                else
                {
                    chk = false;
                    msg = "교체할 대상이 없습니다.";
                }
            }

            return Json(new
            {
                Check = chk,
                Message = msg,
                MusicID = MusicID
            });
        }
Пример #4
0
        public JsonResult MusicInfo(long MusicID)
        {
            Music music = new Music();

            using (var context = new SharedPlayerContext())
            {
                music = context.Musics.Where(x => x.MusicID == MusicID).FirstOrDefault() ?? new Music();
            }

            return Json(new
            {
                User = this.LoginMember,
                Music = music
            });
        }
Пример #5
0
        public JsonResult AddMusicProc(int ChannelID, int Seq, string Title, string URL)
        {
            this.LoginCheck();

            try
            {
                Music music = new Music();

                using (var context = new SharedPlayerContext())
                {    
                    music.ChannelID = ChannelID;
                    music.RegDate = DateTime.Now;
                    if (Seq > 0)
                    {
                        music.Seq = Seq;
                    }
                    else
                    {
                        if (context.Musics.Where(x => x.ChannelID == ChannelID).Count() > 0)
                        {
                            int num = context.Musics.Where(x => x.ChannelID == ChannelID).Max(x => x.Seq);
                            music.Seq = num + 1;
                        }
                        else
                        {
                            music.Seq = 1;
                        }
                    }
                    music.Title = Server.UrlDecode(Title);
                    music.URL = Server.UrlDecode(URL);
                    music.MemberID = this.LoginMember.MemberID;


                    context.Musics.Add(music);
                    context.SaveChanges();
                }

                if (music.MusicID > 0)
                {
                    return Json(new
                    {
                        Check = true,
                        Message = "",
                        ChannelID = ChannelID,
                        MusicID = music.MusicID,
                        UserName = this.LoginMember.NickName
                    });
                }
                else
                {
                    return Json(new
                    {
                        Check = false,
                        Message = "등록하지 못했습니다.",
                        ChannelID = ChannelID
                    });
                }
            }
            catch (Exception ex)
            {
                return Json(new
                {
                    Check = false,
                    Message = ex.Message,
                    ChannelID = ChannelID
                });
            }
        }
Пример #6
0
        public async Task<ActionResult> ModMusic(int ChannelID, long MusicID)
        {
            this.LoginCheck("Channel");

            Channel channel = new Channel();
            Music music = new Music();
            using (var context = new SharedPlayerContext())
            {
                channel = await context.Channels.Where(x => x.ChannelID == ChannelID).FirstOrDefaultAsync().ConfigureAwait(false) ?? new Channel();
                music = await context.Musics.Where(x => x.MusicID == MusicID).FirstOrDefaultAsync().ConfigureAwait(false) ?? new Music();
            }

            ViewBag.channel = channel;
            ViewBag.music = music;

            return View(this);
        }