예제 #1
0
 public void AgregarP(string nombreP, decimal precio, int stock, byte[] imagen, int tipo, string descripcion)
 {
     /* HttpPostedFileBase filea = this.HttpContext.Request.Files.Get("imagen");
      * string nombreP = this.HttpContext.Request.Form["nombre"];
      * string descripcion = this.HttpContext.Request.Form["descripcion"].ToString();
      * int tipo = int.Parse(this.HttpContext.Request.Form["tipo"].ToString());
      * int stock = int.Parse(this.HttpContext.Request.Form["stock"].ToString());
      * decimal precio = decimal.Parse(this.HttpContext.Request.Form["precio"].ToString());
      * // Nombre de la imagen
      * string nombre = filea.FileName.Substring(0, filea.FileName.LastIndexOf("."));
      * // Extensión del archivo
      * string ext = nombre.Substring(nombre.LastIndexOf(".") + 1);
      * // Tipo de contenido
      * string contentType = filea.ContentType;
      * // Imagen convertida a arreglo de bytes
      * byte[] imagen = new byte[filea.InputStream.Length];
      * filea.InputStream.Read(imagen, 0, imagen.Length);    */
     pro.Agregar(nombreP, precio, stock, imagen, tipo, descripcion);
 }