public IActionResult AddFile(AddTrackViewModel model) { if (model.File != null) { string path = model.File.FileName; using (var fileStream = new FileStream(_appEnvironment.WebRootPath + path, FileMode.Create)) { model.File.CopyToAsync(fileStream); } Album album = _albumService.GetById(model.AlbumId); Track track = new Track() { Id = model.Id, Name = model.Name, AlbumId = model.AlbumId, Link = "http://localhost:52527/tracks/" + path, NameAlbum = album.Name }; _trackService.Delete(track); _trackService.Create(track); return(RedirectToAction("GetAlbum", "Home", new { nameArtist = album.NameArtist, nameAlbum = album.Name })); } return(StatusCode(400)); }
public AddTrackView() { InitializeComponent(); DataContext = new AddTrackViewModel(Token); Closed += AddTrackView_Closed; }