Example #1
0
        public async Task <bool> Insert(ITable ety)
        {
            ProjetoTable entity = (ProjetoTable)ety;
            await context.Projetos.AddAsync(entity);

            await context.SaveChangesAsync();

            return(true);
        }
        public async Task <bool> Put(ProjetoTable desenvolvedor)
        {
            var res = await ProCrud.Update(desenvolvedor);

            if (res is true)
            {
                return(true);
            }

            return(false);
        }
Example #3
0
        public async Task <ITable> GetOne(ITable ety, bool isId = true)
        {
            ProjetoTable entity = (ProjetoTable)ety;

            if (isId)
            {
                return(await context.Projetos.FirstOrDefaultAsync(x => x.Id == entity.Id));
            }
            else
            {
                return(await context.Projetos.FirstOrDefaultAsync(x => x.projeto == entity.projeto));
            }
        }
Example #4
0
        public async Task <bool> Update(ITable ety)
        {
            ProjetoTable entity = (ProjetoTable)ety;
            var          res    = context.Projetos.FirstOrDefault(x => x.Id == entity.Id);

            if (res is not null)
            {
                res.projeto   = entity.projeto;
                res.descricao = entity.descricao;
                //foreach (var item in entity.DevsEmProjetosTable)
                //    context.DevsEmProjetos.Remove(item);
                //await this.UpdateProjetos(entity);
                await context.SaveChangesAsync();

                return(true);
            }
            return(false);
        }