Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using MyCloud.Data;
- using MyCloud.Interfaces;
- using MyCloud.Models;
- namespace MyCloud.Repositories
- {
- public class UserRepository : IBaseRepository<User>
- {
- private readonly ApplicationDbContext _db;
- public UserRepository(ApplicationDbContext db)
- {
- _db = db;
- }
- public IQueryable<User> GetAll()
- {
- return _db.Users;
- }
- public async Task Delete(User entity)
- {
- _db.Users.Remove(entity);
- await _db.SaveChangesAsync();
- }
- public async Task Create(User entity)
- {
- await _db.Users.AddAsync(entity);
- await _db.SaveChangesAsync();
- }
- public async Task<User> Update(User entity)
- {
- _db.Users.Update(entity);
- await _db.SaveChangesAsync();
- return entity;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement