Beispiel #1
0
 public static Opcao Salvar(Opcao verdade_)
 {
     using (Repositorio ctx = new Repositorio())
     {
         verdade_.Validar();
         RequisicaoHTTP requisicao = new RequisicaoHTTP();
         ctx.Opcoes.Add(verdade_);
         ctx.SaveChanges();
         return(verdade_);
     }
 }
Beispiel #2
0
        public static Opcao Editar(int uuid, Opcao opcao)
        {
            using (Repositorio ctx = new Repositorio())
            {
                Opcao _opcao = ctx.Opcoes.Where(x => x.id == uuid).FirstOrDefault();
                if (_opcao == null)
                {
                    throw new ApplicationNotFoundException(ApplicationNotFoundException.OPCAO_NAO_ENCONTRADO);
                }

                opcao.Validar();
                _opcao.descricao = opcao.descricao.ToUpper();
                ctx.Opcoes.Update(_opcao);
                ctx.SaveChanges();
                return(_opcao);
            }
        }