Esempio n. 1
0
        public ActionResult Ekle(Reklam model, HttpPostedFileBase ReklamResim)
        {
            ModelState.Remove("ResimYol");
            if (ModelState.IsValid)
            {
                if (ReklamResim != null &&
                    (ReklamResim.ContentType == "image/jpeg" ||
                     ReklamResim.ContentType == "image/jpg" ||
                     ReklamResim.ContentType == "image/png"))
                {
                    try
                    {
                        string filename = $"{AdGetir.ResimAd(model.ReklamAdi)}.{ReklamResim.ContentType.Split('/')[1]}";
                        ReklamResim.SaveAs(Server.MapPath($"~/img/Reklam/{filename}"));
                        model.ResimYol = filename;
                    }
                    catch (Exception exp)
                    {
                        ModelState.AddModelError("", exp.Message);
                    }
                }

                int res = _managerReklam.Insert(model);
                if (res > 0)
                {
                    return(RedirectToAction("Index", "Reklam"));
                }
                ModelState.AddModelError("", "Kategori Güncellenemedi");
                return(View(model));
            }
            return(View(model));
        }
Esempio n. 2
0
    void Start()
    {
        if (reklam == null)
        {
            DontDestroyOnLoad(gameObject);
            reklam = this;
            #if UNITY_ANDROID
            string appId = "ca - app - pub - 2870930756867982~4544661851";
            #elif UNITY_IPHONE
            string appId = "ca-app-pub-3940256099942544~1458002511";
            #else
            string appId = "unexpected_platform";
            #endif

            MobileAds.Initialize(appId);
            //------------------//
            #if UNITY_ANDROID
            string adUnitId = "ca-app-pub-2870930756867982/1343783448";
            #elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-3940256099942544/4411468910";
            #else
            string adUnitId = "unexpected_platform";
            #endif

            interstitial = new InterstitialAd(adUnitId);
            //------------------//
            AdRequest request = new AdRequest.Builder().Build();

            interstitial.LoadAd(request);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 3
0
        public ActionResult ReklamSil(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Reklam frm = _managerReklam.Find(x => x.ID == id.Value);

            if (frm == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            try
            {
                if (System.IO.File.Exists(Server.MapPath("~/img/Reklam/" + frm.ResimYol)))
                {
                    System.IO.File.Delete(Server.MapPath("~/img/Reklam/" + frm.ResimYol));
                }

                _managerReklam.Delete(frm);
            }
            catch { }

            return(RedirectToAction("Index", "Reklam"));
        }
Esempio n. 4
0
 public void ReklamGoster()
 {
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
     reklam = null;
     Destroy(gameObject);
 }
Esempio n. 5
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else if (this != instance)
     {
         Destroy(gameObject);
         return;
     }
 }
    void Start()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        if (reklamKontrol == null)
        {
            DontDestroyOnLoad(gameObject);
            reklamKontrol = this;

            //1. Asama----------------------------------------------------
            #if UNITY_ANDROID
            string appId = "ca-app-pub-2599972005525985~4349708701";
            #elif UNITY_IPHONE
            string appId = "ca-app-pub-3940256099942544~1458002511";
            #else
            string appId = "unexpected_platform";
            #endif

            MobileAds.Initialize(appId);

            //2. Asama----------------------------------------------------
            #if UNITY_ANDROID
            //string adUnitId = "ca-app-pub-3940256099942544/1033173712";
            string adUnitId = "ca-app-pub-2599972005525985/3498240584"; //Test
            #elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-3940256099942544/4411468910";
            #else
            string adUnitId = "unexpected_platform";
            #endif

            interstitial = new InterstitialAd(adUnitId);

            //3. Asama----------------------------------------------------

            AdRequest request = new AdRequest.Builder().Build();
            //          AdRequest request = new AdRequest.Builder()
            //.AddTestDevice(AdRequest.TestDeviceSimulator).AddTestDevice("2077ef9a63d2b398840261c8221a0c9b")
            //.Build();


            interstitial.LoadAd(request);

            //4. Asama----------------------------------------------------
        }
        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 7
0
        public ActionResult Duzenle(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Reklam kat = _managerReklam.Find(x => x.ID == id.Value);

            if (kat == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            return(View(kat));
        }
Esempio n. 8
0
    void Start()
    {
        if (reklamKontrol == null)
        {
            DontDestroyOnLoad(gameObject);//sahneler arası objeler silinmiyor.
            reklamKontrol = this;
            //1.aşama----------
#if UNITY_ANDROID
            string appId = "ca-app-pub-5961913907607762~1742359067";
#elif UNITY_IPHONE
            string appId = "ca-app-pub-3940256099942544~1458002511";
#else
            string appId = "unexpected_platform";
#endif

            // Initialize the Google Mobile Ads SDK.
            MobileAds.Initialize(appId);
            //2.aşama----------
#if UNITY_ANDROID
            string adUnitId = "ca-app-pub-3940256099942544/1033173712";
#elif UNITY_IPHONE
            string adUnitId = "ca-app-pub-3940256099942544/4411468910";
#else
            string adUnitId = "unexpected_platform";
#endif

            // Initialize an InterstitialAd.
            interstitial = new InterstitialAd(adUnitId);

            //3.aşama----------
            AdRequest request = new AdRequest.Builder()
                                .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b")
                                .Build();
            interstitial.LoadAd(request);
            //4.aşama-------
        }
        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 9
0
        public ActionResult Duzenle(Reklam model, HttpPostedFileBase ReklamResim)
        {
            ModelState.Remove("ResimYol");
            if (ModelState.IsValid)
            {
                Reklam kat = _managerReklam.Find(x => x.ID == model.ID);
                kat.ReklamAdi   = model.ReklamAdi;
                kat.ReklamCesit = model.ReklamCesit;
                kat.ReklamLink  = model.ReklamLink;
                if (ReklamResim != null &&
                    (ReklamResim.ContentType == "image/jpeg" ||
                     ReklamResim.ContentType == "image/jpg" ||
                     ReklamResim.ContentType == "image/png"))
                {
                    try
                    {
                        if (System.IO.File.Exists(Server.MapPath("~/img/Reklam/" + model.ResimYol)))
                        {
                            System.IO.File.Delete(Server.MapPath("~/img/Reklam/" + model.ResimYol));
                        }


                        string filename = $"{AdGetir.ResimAd(model.ReklamAdi)}.{ReklamResim.ContentType.Split('/')[1]}";
                        ReklamResim.SaveAs(Server.MapPath($"~/img/Reklam/{filename}"));
                        kat.ResimYol = filename;
                    }
                    catch (Exception exp)
                    {
                        ModelState.AddModelError("", exp.Message);
                    }
                }

                int res = _managerReklam.Update(kat);
                if (res > 0)
                {
                    return(RedirectToAction("Index", "Reklam"));
                }
                ModelState.AddModelError("", "Kategori Güncellenemedi");
            }
            return(View(model));
        }
        public ActionResult Add(Reklam reklam)
        {
            var jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(reklam);

            var request = (HttpWebRequest)WebRequest.Create("https://dene-fe577.firebaseio.com/Reklam.json?auth=wXfzHDOIFOnZpzsrm6Dpb40Wx9fP2hpDT31BU9lY");
            var data    = Encoding.ASCII.GetBytes(jsonStr);

            request.Method        = "POST";
            request.ContentType   = "application/json";
            request.ContentLength = data.Length;

            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }

            var response       = (HttpWebResponse)request.GetResponse();
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

            return(RedirectToAction(actionName: "List", controllerName: "Reklam"));
        }