public async Task <IEnumerable <FileReference> > GetFilesForAuthorAsync(string authorName) { using (var db = new FileDbContext()) { return(await db.FileReferences.Where(p => p.Author.Name == authorName).ToListAsync()); } }
public async static void SaveFileToDatabase(File fileModel) { using (var context = new FileDbContext()) { context.Files.Add(fileModel); await context.SaveChangesAsync(); } }
public ReportProblemService(AppDbContext appDbContext, IMapper mapper, IEmailService emailService, IEncryptionManager encryption, FileDbContext fileDbContext, IUserIPAddress userIPAddress) { _appDbContext = appDbContext; _mapper = mapper; _emailService = emailService; _fileDbContext = fileDbContext; _userIPAddress = userIPAddress; }
public FileController(IFileService fileService, IOptions <MinIoConfig> minIoConfig, AppDbContext appDbContext, MongoDbContext mongoDbContext, FileDbContext fileDbContext) { _fileService = fileService; _minIoConfig = minIoConfig.Value; _appDbContext = appDbContext; _mongoDbContext = mongoDbContext; _fileDbContext = fileDbContext; }
public async static void SaveStatusToDatabase(Status status) { using (var context = new FileDbContext()) { context.Statuses.Add(status); await context.SaveChangesAsync(); } }
public FileService(IMapper mapper, FileDbContext fileDbContext, AppDbContext dbContext, IEncryptionManager encryption, IProfilePercentageCalculationService profilePercentageCalculation, MongoDbContext mongoDbContext, IUserIPAddress userIPAddress) { _mapper = mapper; _fileDbContext = fileDbContext; _appDbContext = dbContext; _encryption = encryption; _profilePercentageCalculation = profilePercentageCalculation; _mongoDbContext = mongoDbContext; _userIPAddress = userIPAddress; }
public ActivityAndChallengesService(AppDbContext appDbContext, IMapper mapper, FileDbContext fileDbContext, IApplicationProgressStatusService applicationProgressService, MongoDbContext mongoDbcontext, IOptions <MinIoConfig> minIoConfig, IUserIPAddress userIPAddress) { _appDbContext = appDbContext; _mapper = mapper; _fileDbContext = fileDbContext; _applicationProgressService = applicationProgressService; _mongoDbcontext = mongoDbcontext; _minIoConfig = minIoConfig.Value; _userIPAddress = userIPAddress; }
public ProgramService(AppDbContext appDbContext, IMapper mapper, FileDbContext fileDbContext, IApplicationProgressStatusService applicationProgressService, MongoDbContext mongoDbcontext, IEmailService emailService, IOptions <MinIoConfig> minIoConfig, IUserIPAddress userIPAddress) { _appDbContext = appDbContext; _mapper = mapper; _fileDbContext = fileDbContext; _applicationProgressService = applicationProgressService; _mongoDbcontext = mongoDbcontext; _emailService = emailService; _minIoConfig = minIoConfig.Value; _userIPAddress = userIPAddress; }
public IndexModel(ILogger <IndexModel> logger, FileDbContext fileDbContext, DirectoryService directoryService, FileService fileService, FileSharedService fileSharedService) { _logger = logger; this.fileDbContext = fileDbContext; this.directoryService = directoryService; this.fileService = fileService; this.fileSharedService = fileSharedService; }
public FilesController(ILogger <FilesController> logger, MergingQueue mergingQueue, FileDbContext dbContext, IConfiguration configuration, IMemoryCache memoryCache) { _logger = logger; _mergingQueue = mergingQueue; _dbContext = dbContext; _configuration = configuration; _memoryCache = memoryCache; }
public void DeveRetornarArquivoNuloPorIdSeNaoExistir() { using (var context = new FileDbContext(GetDbContextOptions())) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var fileS3Repository = new FileS3Repository(context); int invalidId = 0; var fileS3Result = fileS3Repository.GetById(invalidId); Assert.Null(fileS3Result); } }
public void DeveRetornarListaVazia() { using (var context = new FileDbContext(GetDbContextOptions())) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var fileS3Repository = new FileS3Repository(context); var fileS3Result = fileS3Repository.GetAll(); Assert.NotNull(fileS3Result); Assert.Equal(0, fileS3Result.Count); } }
public void DeveSalvarComSucesso() { using (var context = new FileDbContext(GetDbContextOptions())) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var fileS3Repository = new FileS3Repository(context); var fileS3 = GetNewRandomFileS3(); var fileS3Result = fileS3Repository.Add(fileS3); Assert.NotNull(fileS3Result); } }
public void DeveRetornarArquivoPorId() { using (var context = new FileDbContext(GetDbContextOptions())) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var fileS3Repository = new FileS3Repository(context); var fileS3 = fileS3Repository.Add(GetNewRandomFileS3()); var fileS3Result = fileS3Repository.GetById(fileS3.Id); Assert.NotNull(fileS3Result); Assert.Equal(fileS3.Id, fileS3Result.Id); } }
public async Task <FileReference> InsertFileReferenceAsync(FileReference fileReference) { using (var db = new FileDbContext()) { if (await db.FileReferences.AnyAsync(p => p.AuthorId == fileReference.Author.Id && p.Name == fileReference.Name)) { throw new FileReferenceAlreadyExistsException(); } db.FileReferences.Add(fileReference); db.Entry(fileReference.Author).State = EntityState.Unchanged; var saved = await db.SaveChangesAsync(); } return(fileReference); }
public async Task <User> GetOrCreateUserAsync(string name) { using (var db = new FileDbContext()) { var dbUser = await db.Users.FirstOrDefaultAsync(p => p.Name == name); if (dbUser == null) { dbUser = new User { Name = name }; db.Users.Add(dbUser); await db.SaveChangesAsync(); } return(dbUser); } }
public Main() { InitializeComponent(); noteContext = new NoteDbContext(); fileContext = new FileDbContext(); InitNavigate(); tree_Navi.MouseClick += NoteOPerate; Main_Container.Panel2.MouseClick += MouseClick; btn_addFile.Click += addFile; btn_delFile.Click += delFile; btn_newNote.Click += newNote; btn_delNote.Click += delNote; btnSave.Click += Save; }
public void DeveRetornarTodosRegistros() { using (var context = new FileDbContext(GetDbContextOptions())) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var fileS3Repository = new FileS3Repository(context); List <FileS3> files = new List <FileS3>(); files.Add(fileS3Repository.Add(GetNewRandomFileS3())); files.Add(fileS3Repository.Add(GetNewRandomFileS3())); files.Add(fileS3Repository.Add(GetNewRandomFileS3())); var fileS3Result = fileS3Repository.GetAll(); Assert.NotNull(fileS3Result); Assert.Equal(files.Count, fileS3Result.Count); } }
public void DeveAtualizarArquivo() { using (var context = new FileDbContext(GetDbContextOptions())) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var fileS3Repository = new FileS3Repository(context); var fileS3 = fileS3Repository.Add(GetNewRandomFileS3()); string newBucketName = "new-bucket-name"; string newFileName = "new-filename.png"; string mimeType = "image/png"; fileS3.SetBucketName(newBucketName); fileS3.SetFileName(newFileName); fileS3.SetFilePath(newFileName); fileS3.SetContentType(mimeType); var fileS3Result = fileS3Repository.Update(fileS3); Assert.NotNull(fileS3Result); Assert.Equal(newBucketName, fileS3Result.BucketName); } }
public FilesController(FileDbContext context, IHostingEnvironment appEnvironment) { app = appEnvironment; this.context = context; }
public DatabaseApiController(FileDbContext context, IWebHostEnvironment webHostEnvironment) { FileDbContext = context; this.webHostEnvironment = webHostEnvironment; }
public FileController(ILogger <FileController> logger, FileServConfig config, FileDbContext dbContext) { _log = logger; _config = config; _context = dbContext; }
public FileEntityService(FileDbContext context) { _context = context; }
public FileS3Repository(FileDbContext context) { _context = context; }
public DirectoryService(FileDbContext fileDbContext, IHttpContextAccessor httpContextAccessor) { this.fileDbContext = fileDbContext; userId = httpContextAccessor.HttpContext.User?.Claims.FirstOrDefault(e => e.Type == "sub")?.Value; }
public GenericRepository(FileDbContext context) { _dbSet = context.Set <TEntity>(); }
public MovieRepository(FileDbContext _db) { this.db = _db; }
public FileManager(FileDbContext context) { _context = context; }
public FileRepository(FileDbContext fileDbContext) { this._fileDbContext = fileDbContext; }
public TokenController(IConfiguration config, FileDbContext fileDbContext) { _configuration = config; _fileDbContext = fileDbContext; }