Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        public List <TeamMember> GetAllMembers()
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                List <TeamMember> entities = context.Set <TeamMember>().ToList();

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

                return(entities);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 5
0
        public List <TaskItem> GetAllItems()
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                List <TaskItem> entities = context.Set <TaskItem>().ToList();

                return(entities);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 7
0
        public Task <IEnumerable <T> > GetAll()
        {
            using (ToDoAppDbContext context = _contextFactory.CreateContext())
            {
                IEnumerable <T> entities = context.Set <T>().ToList();

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

                return(createdEntity);
            }
        }
Ejemplo n.º 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);
            }
        }