Beispiel #1
0
        public async Task <bool> Delete(int id)
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                TeamMember entity = context.Set <TeamMember>().FirstOrDefault((e) => e.Id == id);
                context.Set <TeamMember>().Remove(entity);
                await context.SaveChangesAsync();

                return(true);
            }
        }
Beispiel #2
0
        public List <TeamMember> GetAllMembers()
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                List <TeamMember> entities = context.Set <TeamMember>().ToList();

                return(entities);
            }
        }
Beispiel #3
0
        public async Task <IEnumerable <TeamMember> > GetAll()
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                IEnumerable <TeamMember> entities = await context.Set <TeamMember>().ToListAsync();

                return(entities);
            }
        }
Beispiel #4
0
        public async Task <TeamMember> Get(int id)
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                TeamMember entity = context.Set <TeamMember>().FirstOrDefault((e) => e.Id == id);

                return(entity);
            }
        }
Beispiel #5
0
        public List <TaskItem> GetAllItems()
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                List <TaskItem> entities = context.Set <TaskItem>().ToList();

                return(entities);
            }
        }
Beispiel #6
0
        public List <TaskItem> GetByDates(DateTime?date)
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                List <TaskItem> entities = context.Set <TaskItem>().Where(((e) => e.TaskDate == date)).ToList();

                return(entities);
            }
        }
        public Task <IEnumerable <T> > GetAll()
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                IEnumerable <T> entities = context.Set <T>().ToList();

                return((Task <IEnumerable <T> >)entities);
            }
        }
        public async Task <T> Create(T entity)
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                var createdEntity = context.Set <T>().Add(entity);
                await context.SaveChangesAsync();

                return(createdEntity);
            }
        }
Beispiel #9
0
        public async Task <TeamMember> Update(int id, TeamMember entity)
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                entity.Id = id;

                context.Set <TeamMember>().Add(entity);

                await context.SaveChangesAsync();

                return(entity);
            }
        }