Ejemplo n.º 1
0
        public async Task <bool> InsertCollectPath(string folder)
        {
            try
            {
                if (Internal.StaticFolders.IsValidFolder(folder))
                {
                    var model = new Models.CollectPath
                    {
                        Added                = DateTime.UtcNow,
                        FilesFound           = 0,
                        Id                   = Guid.NewGuid(),
                        LastCheck            = null,
                        Path                 = folder,
                        SubFoldersFound      = 0,
                        SubFoldersFilesFound = 0,
                        TotalFilesFound      = 0
                    };
                    await _repository.Insert(model);

                    return(true);
                }
                else
                {
                    return(false);
                }
            } catch (Exception ex)
            {
                _logger.Error(ex);
                return(false);
            }
        }
Ejemplo n.º 2
0
 public async Task <bool> DeleteCollectPath(Models.CollectPath collectPath)
 {
     try
     {
         if (collectPath != null)
         {
             return(await _repository.Delete(collectPath));
         }
         return(false);
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
         return(false);
     }
 }
Ejemplo n.º 3
0
        public async Task <bool> Delete(Models.CollectPath collectPath)
        {
            try
            {
                if (collectPath != null)
                {
                    await _dBContext.Instance.DeleteAsync(collectPath);

                    return(true);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Failed to delete CollectPath item");
            }
            return(false);
        }