public IActionResult Create()
        {
            var model = new CreateMusicViewModel()
            {
                Singers = _singerAppService.GetPublishedSingersHasAlbums()?
                          .Select(s => new SelectListItem()
                {
                    Text  = s.Name,
                    Value = s.Id.ToString(),
                }),
                Albums = _albumAppService.GetPublishedAlbums()?
                         .Select(s => new SelectListItemEntity()
                {
                    Item = new SelectListItem()
                    {
                        Text  = s.Name,
                        Value = s.Id.ToString(),
                    },
                    ParentId = s.SingerId.ToString()
                }),
            };

            if (model.Singers.Any())
            {
                model.Singers.First().Selected = true;
            }
            if (model.Albums.Any())
            {
                model.Albums.First().Item.Selected = true;
            }
            return(PartialView("_Create", model));
        }
        public IActionResult Create([FromServices] IHostingEnvironment env, CreateMusicViewModel model)
        {
            if (int.TryParse(model.SingerId, out int singerId) &&
                int.TryParse(model.AlbumId, out int albumId))
            {
                model.File = Request.Form.Files[0];

                var music = new MusicModel()
                {
                    Name      = model.Name,
                    SingerId  = singerId,
                    AlbumId   = albumId,
                    CreatorId = HttpContext.Session.GetCurrentUserId(),
                    FileUrl   = SaveMusicFile(model.File, singerId, albumId)
                };
                music = _musicAppService.Create(music);
                return(Json(new JsonResultEntity()
                {
                    Message = "添加音乐成功!",
                    JsonObject = Json(new MusicViewModel()
                    {
                        Id = music.Id,
                        SingerId = music.SingerId,
                        AlbumId = music.AlbumId,
                        CreatorId = music.CreatorId,
                        Name = music.Name,
                        SingerName = music.SingerName,
                        AlbumName = music.AlbumName,
                        CreatorName = music.CreatorName,
                        FileUrl = music.FileUrl,
                        Duration = music.Duration.GetMinutesAndSeconds(),
                        CreationTime = music.CreationTime.ToStandardDateOfChina(),
                    })
                }));
            }
            else
            {
                throw new JMBasicException("歌唱家不存在");
            }
        }