#103: Added method to create song and moving some code around

This commit is contained in:
kdeng00
2024-08-06 19:51:50 -04:00
parent 77030c6347
commit b3b5a975d9
6 changed files with 66 additions and 4 deletions
@@ -366,6 +366,27 @@ public class SongManager : BaseManager
return song;
}
public int Create(IFormFile file, string filePath, string prompt)
{
if (System.IO.File.Exists(filePath))
{
return 1;
}
using (var filestream = new FileStream(filePath, FileMode.Create))
{
Console.WriteLine(prompt);
file.CopyTo(filestream);
if (System.IO.File.Exists(filePath))
{
return 2;
}
}
return 0;
}
private bool SongRecordChanged(Song currentSong, Song songUpdates)
{