Exemplo n.º 1
0
        public bool addRecarga(RecargaModel recarga, CelularModel celular)
        {
            XElement xmlRec = XElement.Load(this.path);

            XElement insXML = new XElement(
                new XElement("recarga",
                             new XElement("id_recarga", recarga.id_recarga),
                             new XElement("valor", recarga.valor),
                             new XElement("duracion", recarga.descripcion_recarga)));

            xmlRec.Add(insXML);
            ////////////

            XElement xmlLogRec = XElement.Load(this.path);

            XElement insLogXML = new XElement(
                new XElement("recarga",
                             new XElement("id_recarga", recarga.id_recarga),
                             new XElement("NumCelular", celular.numCelular),
                             new XElement("Compania", celular.id_compania),
                             new XElement("Fecha_Ini", System.DateTime.Now),
                             new XElement("valor", recarga.valor),
                             new XElement("duracion", recarga.descripcion_recarga)
                             ));

            xmlLogRec.Add(insLogXML);



            return(true);
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var recargaModel = new RecargaModel();

            var telefones       = entity.Telefone.ToList();
            var formasPagamento = entity.FormaPagamento.ToList();

            recargaModel.Telefones       = new SelectList(telefones, "Id", "Numero");
            recargaModel.FormasPagamento = new SelectList(formasPagamento, "Id", "Descricao");
            recargaModel.Recargas        = entity.Recarga.ToList();
            ViewBag.total = recargaModel.Recargas.Count();

            return(View(recargaModel));
        }
Exemplo n.º 3
0
        public ActionResult IncluirRecarga(RecargaModel recargaModel)
        {
            Recarga recarga = new Recarga
            {
                Id         = recargaModel.Id,
                TelefoneId = recargaModel.TelefoneId,
                FormaPagId = recargaModel.FormaPagId,
                Data       = DateTime.Now,
                Valor      = recargaModel.Valor
            };


            if (recarga.Id <= 0)
            {
                entity.Recarga.Add(recarga);
            }
            else
            {
                entity.Entry(recarga).State = EntityState.Modified;
            }
            entity.SaveChanges();

            return(RedirectToAction("Index"));
        }