public IActionResult UpdateBasic(int id, UpdateBasicAlbumViewModel model) { var album = _albumAppService.GetAlbumById(id); model = new UpdateBasicAlbumViewModel() { Id = album.Id, Name = album.Name, Singers = _singerAppService.GetPublishedSingers()? .Select(s => new SelectListItem() { Text = s.Name, Value = s.Id.ToString(), Selected = s.Id == album.SingerId }) }; return(PartialView("_UpdateBasic", model)); }
private string SaveMusicFile(IFormFile file, int singerId, int albumId) { var singer = _singerAppService.GetSingerById(singerId); var album = _albumAppService.GetAlbumById(albumId); var fileName = FileHelper.GetFullFileNameOfMusic(file.ContentDisposition, singer, album); if (!EntityFramework.Persistences.GlobalHelper.IsEffectiveMusicFile(fileName)) { throw new JMBasicException("文件无效"); } if (file.SaveTo(fileName)) { return(fileName); } throw new JMBasicException("文件上传失败"); }