public ActionResult logo(HttpPostedFileBase logo)
        {
            try
            {
                string uzanti = System.IO.Path.GetExtension(logo.FileName);

                if (logo != null && logo.ContentLength > 0 || uzanti == ".jpg" || uzanti == ".jpeg" || uzanti == ".png" || uzanti == ".PNG" || uzanti == ".JPG" || uzanti == ".JPEG")
                {
                    Random r          = new Random();
                    var    resim_ayar = data.RESIM_AYARs.First();

                    string resim_adi = r.NextDouble().ToString() + r.NextDouble().ToString() + uzanti;
                    string dizin     = Server.MapPath("~") + "Content\\img\\";


                    Resim image = new Resim();


                    image.ResimYukle(logo, dizin + resim_adi);


                    //VARI TABANINA ISLE
                    var site_bilgileri = data.SITE_BILGILERIs.First();
                    site_bilgileri.LOGO = resim_adi;

                    data.SubmitChanges();


                    mesaj[0]      = "alert-info"; mesaj[1] = "Logo Güncellendi..";
                    ViewBag.mesaj = mesaj;
                }
                else
                {
                    mesaj[0]      = "alert-info"; mesaj[1] = "Lütfen Logo Seçiniz..";
                    ViewBag.mesaj = mesaj;
                }
            }
            catch
            {
                mesaj[0]          = "alert-error"; mesaj[1] = "Logo Eklenirken hata oluştu !";
                TempData["mesaj"] = mesaj;
            }



            ViewBag.TemaName = data.TEMALARs.First().TEMA_ADI; // System.Web.Configuration.WebConfigurationManager.AppSettings["ThemeName"].ToString();

            ViewBag.site_bilgileri     = data.SITE_BILGILERIs.First();
            ViewBag.sosyal_medya       = data.SOSYAL_MEDYAs.First();
            ViewBag.iletisim_bilgileri = data.ILETISIM_BILGILERIs.First();



            mesaj[0]          = "alert-info"; mesaj[1] = "Logo Güncellendi";
            TempData["mesaj"] = mesaj;


            return(Redirect("/Admin/ayarlar"));
        }
示例#2
0
        public ActionResult ekle(string aciklama, string baslik, HttpPostedFileBase resim, int sira_no)
        {
            try
            {
                if (resim != null && resim.ContentLength > 0)
                {
                    Random r          = new Random();
                    var    resim_ayar = data.RESIM_AYARs.First();

                    string resim_adi = r.NextDouble().ToString() + r.NextDouble().ToString() + ".jpg";
                    string dizin     = Server.MapPath("~") + "Content\\img\\referanslar\\";


                    Resim image = new Resim();

                    image.ResimYukle(resim, dizin + resim_adi);



                    // VERI TABANINA EKLE
                    REFERANSLAR yeni = new REFERANSLAR();
                    yeni.BASLIK   = baslik;
                    yeni.ACIKLAMA = aciklama;
                    yeni.RESIM    = resim_adi;
                    yeni.SIRA_NO  = sira_no;

                    data.REFERANSLARs.InsertOnSubmit(yeni);
                    data.SubmitChanges();


                    mesaj[0]      = "alert-info"; mesaj[1] = "Referans başarıyla eklendi..";
                    ViewBag.mesaj = mesaj;
                }
                else
                {
                    mesaj[0]      = "alert-info"; mesaj[1] = "Lütfen Resim Seçiniz..";
                    ViewBag.mesaj = mesaj;
                }
            }
            catch
            {
                mesaj[0]      = "alert-error"; mesaj[1] = "Referans Eklenirken hata oluştu !";
                ViewBag.mesaj = mesaj;
            }



            return(View());
        }