public IHttpActionResult PutCLiente(int id, CLiente cLiente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cLiente.cli_ID)
            {
                return(BadRequest());
            }

            db.Entry(cLiente).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CLienteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public IActionResult Registrar(IFormCollection form)
        {
            Pedido pedido = new Pedido();

            Shake shake = new Shake();

            shake.Nome  = form["shake"];
            shake.Preco = 0.0;

            pedido.shake = shake;

            Hamburguer hamburguer = new Hamburguer(form["hamburguer"], 0.0);

            pedido.Hamburguer = hamburguer;

            Cliente cliente = new CLiente()
            {
                Nome     = form["nome"],
                Endereco = form["endereco"],
                Telefone = form["telefone"],
                Email    = form["email"]
            };

            pedido.Cliente = cliente;

            pedido.DataDoPedido = DateTime.Now;

            pedido.PrecoTotal = 0.0;

            PedidoRepository.Inserir(pedido);


            return(ViewComponent("Sucesso"));
        }
        static void Main(string[] args)
        {
            CLiente  informacioncliente = new CLiente("villamar", "lisseth", 1314844406, "montecristi");
            GAsolina infogasolina       = new GAsolina("Extra", 3, 5);



            Console.WriteLine("  ***************FACTURA GASOLINA *************** ");
            Console.WriteLine();
            Console.WriteLine(" INGRESE LOS DATOS DEL CLIENTE  ");
            Console.WriteLine("____________________________________");


            Console.Write(" APELLIDOS: ");
            informacioncliente.APELLIDOS = Console.ReadLine();
            Console.Write(" NOMBRES : " + " ");
            informacioncliente.NOMBRE = Console.ReadLine();
            Console.Write(" # CÉDULA: " + " ");
            informacioncliente.CEDULA = int.Parse(Console.ReadLine());
            Console.Write(" DIRECCIÓN: " + " ");
            informacioncliente.DIRECCIÓN = Console.ReadLine();

            Console.WriteLine(" ---------- INFORMACIÓN DE LA VENTA ---------- ");
            Console.WriteLine(" TIPO DE GASOLINA INGRESE SEGUN DESEE:  EXTRA , SUPER  ");
            infogasolina.TIPO = Console.ReadLine();
            Console.WriteLine(" CANTIDAD DE GALONES:" + "   ");
            infogasolina.GALONES = int.Parse(Console.ReadLine());
            Console.WriteLine(" PRECIO POR GALÓN: " + infogasolina.PRECIO);
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("   " + "   " + "SUBTOTAL: " + infogasolina.SUBTOTAL);
            Console.WriteLine("   " + "   " + "IVA: " + infogasolina.IVA);
            Console.WriteLine("   " + "   " + " TOTAL: " + infogasolina.TOTALPAGO);
            Console.WriteLine("   " + "   " + "GRACIAS PRO SU CONSUMO, TENGA UN BUEN DÍA ");
        }
        public IHttpActionResult GetCLiente(int id)
        {
            CLiente cLiente = db.CLientes.Find(id);

            if (cLiente == null)
            {
                return(NotFound());
            }

            return(Ok(cLiente));
        }
        public IHttpActionResult PostCLiente(CLiente cLiente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CLientes.Add(cLiente);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = cLiente.cli_ID }, cLiente));
        }
        public IHttpActionResult DeleteCLiente(int id)
        {
            CLiente cLiente = db.CLientes.Find(id);

            if (cLiente == null)
            {
                return(NotFound());
            }

            db.CLientes.Remove(cLiente);
            db.SaveChanges();

            return(Ok(cLiente));
        }
Beispiel #7
0
        public ActionResult Index(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                var NuevoCliente = new CLiente
                {
                    nombre      = collection["nombre"],
                    Descripcion = collection["Descripcion"],
                    Apellido    = collection["Apellido"],
                    Telefono    = collection["Telefono"]
                };

                GuardandoUsuario.Add(NuevoCliente);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }