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)); } }
public async Task <IEnumerable <Issue> > GetAll() { using (TaskManagementDbContext context = new TaskManagementDbContext()) { IEnumerable <Issue> entities = await context.Issues.Include(a => a.Tasks).ToListAsync(); return(entities); } }
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); } }
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)); } }
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); } }
public async Task <IEnumerable <T> > GetAll() { using (TaskManagementDbContext context = new TaskManagementDbContext()) { IEnumerable <T> entities = await context.Set <T>().ToListAsync(); return(entities); } }
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); } }
public async Task <int> Update(T entity) { using (TaskManagementDbContext context = new TaskManagementDbContext()) { context.Entry(entity).State = EntityState.Modified; await context.SaveChangesAsync(); return(entity.Id); } }
public TaskEvents(TaskManagementDbContext activeDbContext) { if (activeDbContext == null) { throw new ArgumentNullException(nameof(activeDbContext)); } ActiveDbContext = activeDbContext; }
public async Task <T> Create(T entity) { using (TaskManagementDbContext context = new TaskManagementDbContext()) { T createdEntity = context.Set <T>().Add(entity); await context.SaveChangesAsync(); return(createdEntity); } }
public TaskController(TaskManagementDbContext context) { _context = context; if (_context.Tasks.Count() == 0) { //_context.Tasks.Add(new Task { Name = "First Task" }); //_context.SaveChanges(); } }
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); } }
public HelperController(TaskManagementDbContext context) { _context = context; }
public TaskUnitRepository(TaskManagementDbContext context) { _context = context; }
public UserRepository(TaskManagementDbContext context) : base(context) { }
public ValueRepository(TaskManagementDbContext context) : base(context) { }
public UserRepository(TaskManagementDbContext dbContext) { _dbContext = dbContext; }
public UnitOfWork(TaskManagementDbContext context) { _context = context; }
public AssignedUserTaskUnitRepository(TaskManagementDbContext context) { this._context = context; }
public TaskHistoryRepository(TaskManagementDbContext dbContext) { _dbContext = dbContext; }
public ProjectController(TaskManagementDbContext context) { _context = context; }