Exemple #1
0
 public IActionResult NewSong([FromForm] NewSongViewModel songData)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var path = Path.Combine(
                 "Assets",
                 songData.file);
             songService.CreateNewSong(songData.Title, songData.Artist, songData.Genre, songData.Price, path);
             //return RedirectToAction("Index");
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception e) { return(BadRequest(e.Message)); }
 }