Пример #1
0
        public ActionResult compraPlan(int planID)
        {
            VmCompraPlan vmComprarPlan = new VmCompraPlan();

            vmComprarPlan.fill(planID);

            return(View(vmComprarPlan));
        }
Пример #2
0
        public ActionResult compraPlan(VmCompraPlan vmComprarPlan)
        {
            try
            {
                Compra compra = new Compra();
                compra.ClienteID = ((Cliente)Session["objUsuario"]).ClienteID;
                compra.PlanID    = vmComprarPlan.planID;
                //insertar codigo de generacion de cosigo QR
                //BarcodeLib. qrbarcode = new BarcodeLib.Barcode();

                //qrbarcode.
                //BarCode qrcode = new BarCode();
                //qrcode.Symbology = KeepAutomation.Barcode.Symbology.QRCode;


                //QRCodeGenerator qrc = new QRCodeGenerator();
                //QRCodeGenerator.QRCode qc = qrc.CreateQrCode(compra.PlanID.ToString(), QRCodeGenerator.ECCLevel.Q);
                //Bitmap bmp = qc.GetGraphic(20);

                //MemoryStream ms = new MemoryStream();

                //bmp.Save(ms, ImageFormat.Png);

                //byte[] bt = ms.ToArray();

                //Image i = new Image();

                //var filename = Path.GetFileName(bt.FileName);
                //var path = Path.Combine(Server.MapPath("~/Content/image/"), filename);
                //file.SaveAs(path);
                //tyre.Url = filename;

                //_db.EventModels.AddObject(eventmodel);
                //_db.SaveChanges();
                //return RedirectToAction("Index");


                compra.QR = "codigo";

                context.Compra.Add(compra);

                context.SaveChanges();

                return(RedirectToAction("planesAdquiridos"));
            }
            catch (Exception)
            {
                return(View());
            }
        }