Files
YABA/API/YABA.Data/Extensions/UsersDbSetExtensions.cs
Carl Tibule 9bbd12e4c3
All checks were successful
ci/woodpecker/tag/api_build Pipeline was successful
ci/woodpecker/tag/api_uploadimage Pipeline was successful
ci/woodpecker/tag/web_uploadimage Pipeline was successful
Created Woodpecker CI/CD deployment
- Created Dockerfile for packing up API and Web projects as Docker image
2024-04-05 23:36:49 -05:00

24 lines
604 B
C#

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YABA.Models;
namespace YABA.Data.Extensions
{
public static class UsersDbSetExtensions
{
public static async Task<bool> UserExistsAsync(this DbSet<User> userDbSet, int userId)
{
return await userDbSet.AnyAsync(x => x.Id == userId);
}
public static bool UserExists(this DbSet<User> userDbSet, int userId)
{
return userDbSet.Any(x => x.Id == userId);
}
}
}