37 lines
926 B
C#
37 lines
926 B
C#
using FileService.Domain.Entities;
|
|
using FileService.Domain.IReposities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FileService.Infrastructure.Reposites
|
|
{
|
|
public class UploadTaskReposity : IUploadTaskReposity
|
|
{
|
|
private readonly FileDbContext db;
|
|
|
|
public UploadTaskReposity(FileDbContext db)
|
|
{
|
|
this.db = db;
|
|
}
|
|
|
|
public void Create(UploadTask task)
|
|
{
|
|
db.Tasks.Add(task);
|
|
}
|
|
|
|
public async Task<UploadTask?> FindByCheckSumAsync(string value)
|
|
{
|
|
return await db.Tasks.FirstOrDefaultAsync(x => x.CheckSum.Value == value);
|
|
}
|
|
|
|
public async Task<UploadTask?> FindByIdAsync(Guid id)
|
|
{
|
|
return await db.Tasks.FirstOrDefaultAsync(x => x.Id == id);
|
|
}
|
|
}
|
|
}
|