Exemple #1
0
 public async Task <Account> GetByUsername(string username)
 {
     using (TaskManagementDbContext context = new TaskManagementDbContext()) {
         return(await context.Accounts
                .Include(a => a.Issues)
                .FirstOrDefaultAsync(a => a.Username == username));
     }
 }
Exemple #2
0
        public async Task <IEnumerable <Issue> > GetAll()
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                IEnumerable <Issue> entities = await context.Issues.Include(a => a.Tasks).ToListAsync();

                return(entities);
            }
        }
Exemple #3
0
        public async Task <Account> Get(int id)
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                Account entity = await context.Accounts.Include(a => a.Issues).FirstOrDefaultAsync((e) => e.Id == id);

                return(entity);
            }
        }
Exemple #4
0
 public async Task <Account> GetByEmail(string email)
 {
     using (TaskManagementDbContext context = new TaskManagementDbContext()) {
         return(await context.Accounts
                .Include(a => a.Issues)
                .FirstOrDefaultAsync(a => a.Email == email));
     }
 }
Exemple #5
0
        public async Task <T> Get(int id)
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                T entity = await context.Set <T>().FirstOrDefaultAsync((e) => e.Id == id);

                return(entity);
            }
        }
Exemple #6
0
        public async Task <IEnumerable <T> > GetAll()
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                IEnumerable <T> entities = await context.Set <T>().ToListAsync();

                return(entities);
            }
        }
Exemple #7
0
        public async Task <Issue> Get(int id)
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                Issue entity = await context.Issues.Include(i => i.Tasks).FirstOrDefaultAsync((e) => e.Id == id);

                return(entity);
            }
        }
Exemple #8
0
        public async Task <int> Update(T entity)
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                context.Entry(entity).State = EntityState.Modified;
                await context.SaveChangesAsync();

                return(entity.Id);
            }
        }
Exemple #9
0
        public TaskEvents(TaskManagementDbContext activeDbContext)
        {
            if (activeDbContext == null)
            {
                throw new ArgumentNullException(nameof(activeDbContext));
            }

            ActiveDbContext = activeDbContext;
        }
Exemple #10
0
        public async Task <T> Create(T entity)
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                T createdEntity = context.Set <T>().Add(entity);
                await context.SaveChangesAsync();

                return(createdEntity);
            }
        }
Exemple #11
0
        public TaskController(TaskManagementDbContext context)
        {
            _context = context;

            if (_context.Tasks.Count() == 0)
            {
                //_context.Tasks.Add(new Task { Name = "First Task" });
                //_context.SaveChanges();
            }
        }
Exemple #12
0
        public async Task <bool> DeleteRange(IEnumerable <T> entities)
        {
            using (TaskManagementDbContext context = new TaskManagementDbContext()) {
                DbSet <T> items = context.Set <T>();
                for (int i = 0; i < entities.Count(); i++)
                {
                    items.Attach(entities.ElementAt(i));
                }
                items.RemoveRange(entities);
                await context.SaveChangesAsync();

                return(true);
            }
        }
Exemple #13
0
 public HelperController(TaskManagementDbContext context)
 {
     _context = context;
 }
 public TaskUnitRepository(TaskManagementDbContext context)
 {
     _context = context;
 }
Exemple #15
0
 public UserRepository(TaskManagementDbContext context) : base(context)
 {
 }
 public ValueRepository(TaskManagementDbContext context) : base(context)
 {
 }
Exemple #17
0
 public UserRepository(TaskManagementDbContext dbContext)
 {
     _dbContext = dbContext;
 }
 public UnitOfWork(TaskManagementDbContext context)
 {
     _context = context;
 }
Exemple #19
0
 public AssignedUserTaskUnitRepository(TaskManagementDbContext context)
 {
     this._context = context;
 }
Exemple #20
0
 public TaskHistoryRepository(TaskManagementDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Exemple #21
0
 public ProjectController(TaskManagementDbContext context)
 {
     _context = context;
 }