public async Task <IActionResult> Edit(int id, [Bind("Id,Codigo,Descricao,HoraInicio,HoraFim,InicioAlmoco,FimAlmoco")] Horario horarios)
        {
            if (id != horarios.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(horarios);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HorariosExists(horarios.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(horarios));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,CodigoSetor,NomeSetor")] Setor setores)
        {
            if (id != setores.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(setores);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SetoresExists(setores.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(setores));
        }
        public async Task UpdateAsync(Funcionario obj)
        {
            bool hasany = await _context.Funcionarios.AnyAsync(x => x.Id == obj.Id);

            if (!hasany)
            {
                throw new ExcecaoNotFound("Funcionario não encontrado");
            }
            try
            {
                _context.Update(obj);
                await _context.SaveChangesAsync();
            }
            catch (ExcecaoConcorrencia e)
            {
                throw new ExcecaoConcorrencia(e.Message);
            }
        }