public async Task <bool> Insert(ITable ety)
        {
            BancoHorasTable dev = (BancoHorasTable)ety;
            var             tt  = context.BancoHoras.Where(x => x.Desenvolvedor == dev.Desenvolvedor);
            double          acc = 0;

            foreach (var i in tt)
            {
                acc += (i.DataFim - i.DataIni).TotalHours;
            }

            var hora = new HorasAcomuladasDevTable()
            {
                Desenvolvedor   = dev.Desenvolvedor,
                HorasAcomuladas = acc
            };
            var coot = context.HorasAcomuladasDev.FirstOrDefault(x => x.Desenvolvedor == dev.Desenvolvedor);

            if (coot is null)
            {
                await context.HorasAcomuladasDev.AddAsync(hora);

                await context.SaveChangesAsync();
            }
            else
            {
                await this.Update(hora);
            }
            return(true);
        }
        public async Task <bool> Insert(ITable ety)
        {
            BancoHorasTable entity = (BancoHorasTable)ety;
            await context.BancoHoras.AddAsync(entity);

            await context.SaveChangesAsync();

            return(true);
        }
Пример #3
0
        public async Task <bool> Insert(ITable ety)
        {
            DesenvolvedorTable entity = (DesenvolvedorTable)ety;
            await context.Desenvolvedores.AddAsync(entity);

            await context.SaveChangesAsync();

            return(true);
        }
Пример #4
0
        public async Task <bool> Insert(ITable ety)
        {
            ProjetoTable entity = (ProjetoTable)ety;
            await context.Projetos.AddAsync(entity);

            await context.SaveChangesAsync();

            return(true);
        }