Beispiel #1
0
        public Elegivel InserirElegivel(Elegivel elegivel)
        {
            var listaElegivel = this.ListarElegivel();

            var maxId = listaElegivel.Max(r => r.FId);

            elegivel.FId = maxId + 1;
            listaElegivel.Add(elegivel);

            AtualizarDbEle(listaElegivel);
            return elegivel;
        }
Beispiel #2
0
        public Elegivel AlterarElegivel(int id, Elegivel elegivel)
        {
            var listaElegivel = this.ListarElegivel();

            var itemIndex = listaElegivel.FindIndex(r => r.FId == id);

            if (itemIndex >= 0)
            {
                elegivel.FId = id;
                listaElegivel[itemIndex] = elegivel;

            }else
            {
                return null;
            }

            AtualizarDbEle(listaElegivel);
            return elegivel;
        }