Ejemplo n.º 1
0
 public async Task <ApiResponse> Get()
 {
     return(await Execute(() =>
     {
         using (SqliteConnection)
         {
             var lModel = new LibraryModel(SqliteConnection);
             lModel.Maintenance();
             Result.Result = true;
             Result.Data = lModel.Get();
         }
     }));
 }
Ejemplo n.º 2
0
        public ActionResult Download(string id)
        {
            using (SqliteConnection)
            {
                var lModel = new LibraryModel(SqliteConnection);
                lModel.Maintenance();
                var library = lModel.Get(id);

                if (library != null && System.IO.File.Exists(library.Path))
                {
                    return(File(System.IO.File.OpenRead(library.Path), "audio/mp4", $"{library.FileName}.m4a"));
                }
                else
                {
                    return(NotFound());
                }
            }
        }