Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "ID,PERIODO,TIR_1,TIR_2,TIR_3,SMVM")] Parametros_Exposiciones parametros)
        {
            if (ModelState.IsValid)
            {
                db.Parametros_Exposiciones.Add(parametros);
                db.Entry(db.Parametros_Exposiciones.Last()).State = System.Data.Entity.EntityState.Added;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(parametros));
        }
        private string AltaExposiciones()
        {
            string periodo = "";

            if (Request.Files.Count > 0)
            {
                if (Request.Files[0] != null)
                {
                    var txt = Request.Files[0];

                    //try
                    //{
                    if (txt != null && txt.ContentLength > 0)
                    {
                        InicializarObjDBSet();

                        StreamReader sr = new StreamReader(txt.InputStream);
                        //Exposiciones exp_formulas = CargarFormulas();

                        while (!sr.EndOfStream)
                        {
                            string linea = sr.ReadLine();
                        }

                        periodo = db.Exposiciones.Local.Last().ID_PERIODO.ToString();

                        sr.Close();
                        db.SaveChanges();
                    }
                    else
                    {
                        //ViewBag.Message = "No se cargó un archivo.";
                    }
                    //}
                    //catch (Exception ex) { }
                }
            }

            return(periodo);
        }