Пример #1
0
        public int guardarDonante([FromBody] DonantesAF oDonantesAF)
        {
            int rpta = 0;

            try
            {
                using (BDAcaassAFContext bd = new BDAcaassAFContext())
                {
                    Donantes oDonantes = new Donantes();
                    oDonantes.IdDonante   = oDonantesAF.IidDonante;
                    oDonantes.Nombre      = oDonantesAF.nombre;
                    oDonantes.Telefono    = oDonantesAF.telefono;
                    oDonantes.Direccion   = oDonantesAF.direccion;
                    oDonantes.Dhabilitado = 1;

                    bd.Donantes.Add(oDonantes);
                    bd.SaveChanges();
                    rpta = 1;
                }
            } catch (Exception ex)
            {
                rpta = 0;
            }



            return(rpta);
        }
Пример #2
0
        public DonantesAF RecuperarDonante(int idDonante)
        {
            using (BDAcaassAFContext bd = new BDAcaassAFContext())
            {
                DonantesAF oDonantesAF = new DonantesAF();

                Donantes oDonantes = bd.Donantes.Where(p => p.IdDonante == idDonante).First();

                oDonantesAF.IidDonante = oDonantes.IdDonante;
                oDonantesAF.nombre     = oDonantes.Nombre;
                oDonantesAF.telefono   = oDonantes.Telefono;
                oDonantesAF.direccion  = oDonantes.Direccion;

                return(oDonantesAF);
            }
        }
Пример #3
0
        public int modificarDonante([FromBody] DonantesAF oDonanteAF)
        {
            int rpta = 0;

            try
            {
                using (BDAcaassAFContext bd = new BDAcaassAFContext())
                {
                    Donantes oDonante = bd.Donantes.Where(p => p.IdDonante == oDonanteAF.IidDonante).First();
                    oDonante.IdDonante = oDonanteAF.IidDonante;
                    oDonante.Nombre    = oDonanteAF.nombre;
                    oDonante.Telefono  = oDonanteAF.telefono;
                    oDonante.Direccion = oDonanteAF.direccion;
                    bd.SaveChanges();
                    rpta = 1;
                }
            }
            catch (Exception ex)
            {
                rpta = 0;
            }
            return(rpta);
        }