Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class UserRepository : IUserRepository
- {
- readonly TinRollContext context;
- public UserRepository(TinRollContext context)
- {
- this.context = context;
- }
- public async Task<User> CreateUserAsync(User user)
- {
- await context.Users.AddAsync(user);
- await context.SaveChangesAsync();
- return user;
- }
- public async Task<User> GetUserAsync(int id)
- {
- return await context.Users.FirstOrDefaultAsync(u => u.Id == id);
- }
- public async Task<IEnumerable<User>> GetUsersAsync()
- {
- return await context.Users.ToListAsync();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement