MyBookmark/Modules.User.Database/Repositories/AccountRepository.cs
THE_KONDRAT 7b16d72329 ui and login
mongo => postgres
2024-11-03 16:08:39 +03:00

23 lines
870 B
C#

using Microsoft.EntityFrameworkCore;
using Modules.User.Database.Database;
using Modules.User.Database.Database.Entities;
using System;
using System.Linq.Expressions;
namespace Modules.User.Database.Repositories;
public class AccountRepository(UserDbContext context)
{
private readonly UserDbContext _context = context;
internal async Task<bool> AnyWhere(Expression<Func<Account, bool>> predicate) =>
await _context.Accounts.AnyAsync(predicate);
internal async Task<Account?> GetFirstOrDefaultWhere(Expression<Func<Account, bool>> predicate) =>
await _context.Accounts.FirstOrDefaultAsync(predicate);
internal async Task<Account> GetFirstWhere(Expression<Func<Account, bool>> predicate) =>
await _context.Accounts.FirstAsync(predicate);
internal async Task UpdateAccountAsync() => await _context.SaveChangesAsync();
}