protected void Button1_Click(object sender, EventArgs e)
 {
     if (FileUpload1.HasFile)
     {
         string virtualFolder = "~/ProjeFotoRes/";
         string asd           = Server.MapPath(virtualFolder);
         string filename      = Guid.NewGuid().ToString();
         string ext           = System.IO.Path.GetExtension(FileUpload1.FileName);
         FileUpload1.SaveAs(System.IO.Path.Combine(asd, filename + ext));
         string finalurl = virtualFolder + filename + ext;
         using (GunkarSogutmaEntities10 Entities = new GunkarSogutmaEntities10())
         {
             GunkarSogutma.GProje ResimListeleme = new GunkarSogutma.GProje();
             ResimListeleme.ProjeFotosu = finalurl;
             ResimListeleme.ProjeAdi    = TextBox1.Text.Trim();
             Entities.GProje.Add(ResimListeleme);
             Entities.SaveChanges();
         }
         Response.Redirect("ProjeEkle.aspx");
     }
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (FileUpload1.HasFile)
     {
         string virtualFolder = "~/Referanslarimiz/";
         string asd           = Server.MapPath(virtualFolder);
         string filename      = Guid.NewGuid().ToString();
         string ext           = System.IO.Path.GetExtension(FileUpload1.FileName);
         FileUpload1.SaveAs(System.IO.Path.Combine(asd, filename + ext));
         string finalurl = virtualFolder + filename + ext;
         using (GunkarSogutmaEntities10 Entities = new GunkarSogutmaEntities10())
         {
             GunkarSogutma.GReferans Listem = new GunkarSogutma.GReferans();
             Listem.ReferansFotosu = finalurl;
             Listem.ReferansAdı    = TextBox1.Text.Trim();
             Entities.GReferans.Add(Listem);
             Entities.SaveChanges();
         }
         Response.Redirect("ReferansEkle.aspx");
     }
 }
Example #3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (FileUpload1.HasFile)
     {
         string virtualFolder = "~/Images/";
         string asd           = Server.MapPath(virtualFolder);
         string filename      = Guid.NewGuid().ToString();
         string ext           = System.IO.Path.GetExtension(FileUpload1.FileName);
         FileUpload1.SaveAs(System.IO.Path.Combine(asd, filename + ext));
         string finalurl = virtualFolder + filename + ext;
         using (GunkarSogutmaEntities10 Entities = new GunkarSogutmaEntities10())
         {
             GunkarSogutma.GGUrunler ResimListeleme = new GunkarSogutma.GGUrunler();
             ResimListeleme.UrunResimYolu = finalurl;
             ResimListeleme.UrunAdi       = TextBox1.Text.Trim();
             ResimListeleme.kategoriId    = int.Parse(DropDownList1.SelectedValue);
             Entities.GGUrunler.Add(ResimListeleme);
             Entities.SaveChanges();
         }
         Response.Redirect("Listeleme.aspx");
     }
 }