D:
/
vhosts
/
kolejfm.com.tr
/
admin.kolejfm.com.tr
/
Views
/
Haberler
/
Upload File
HOME
@model kolejfm.Models.Haberler @{ ViewBag.Title = "guncelle"; Layout = "~/Views/Shared/_LayoutPage1.cshtml"; } <head> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="~/Scripts/tinymce/tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector: 'textarea' }); </script> <style> .switch { position: relative; display: block; vertical-align: top; width: 100px; height: 30px; padding: 3px; margin: 0 10px 10px 0; background: linear-gradient(to bottom, #eeeeee, #FFFFFF 25px); background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF 25px); border-radius: 18px; box-shadow: inset 0 -1px white, inset 0 1px 1px rgba(0, 0, 0, 0.05); cursor: pointer; box-sizing: content-box; } .switch-input { position: absolute; top: 0; left: 0; opacity: 0; box-sizing: content-box; } .switch-label { position: relative; display: block; height: inherit; font-size: 10px; text-transform: uppercase; background: #eceeef; border-radius: inherit; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15); box-sizing: content-box; } .switch-label:before, .switch-label:after { position: absolute; top: 50%; margin-top: -.5em; line-height: 1; -webkit-transition: inherit; -moz-transition: inherit; -o-transition: inherit; transition: inherit; box-sizing: content-box; } .switch-label:before { content: attr(data-off); right: 11px; color: #aaaaaa; text-shadow: 0 1px rgba(255, 255, 255, 0.5); } .switch-label:after { content: attr(data-on); left: 11px; color: #FFFFFF; text-shadow: 0 1px rgba(0, 0, 0, 0.2); opacity: 0; } .switch-input:checked ~ .switch-label { background: #E1B42B; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 0 3px rgba(0, 0, 0, 0.2); } .switch-input:checked ~ .switch-label:before { opacity: 0; } .switch-input:checked ~ .switch-label:after { opacity: 1; } .switch-handle { position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; background: linear-gradient(to bottom, #FFFFFF 40%, #f0f0f0); background-image: -webkit-linear-gradient(top, #FFFFFF 40%, #f0f0f0); border-radius: 100%; box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2); } .switch-handle:before { content: ""; position: absolute; top: 50%; left: 50%; margin: -6px 0 0 -6px; width: 12px; height: 12px; background: linear-gradient(to bottom, #eeeeee, #FFFFFF); background-image: -webkit-linear-gradient(top, #eeeeee, #FFFFFF); border-radius: 6px; box-shadow: inset 0 1px rgba(0, 0, 0, 0.02); } .switch-input:checked ~ .switch-handle { left: 74px; box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2); } /* Transition ========================== */ .switch-label, .switch-handle { transition: All 0.3s ease; -webkit-transition: All 0.3s ease; -moz-transition: All 0.3s ease; -o-transition: All 0.3s ease; } </style> </head> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-header text-uppercase">Haber Ekle <small>Bu sayfa site de haberler bilgileri bölümünde yayınlanacak</small></div> <div class="x_content"> @using (Html.BeginForm("resimguncelle", "Haberler", FormMethod.Post, new { enctype = "multipart/form-data" })) { <div class="form-group"> <label>Resim Seç</label> <br /> <input type="file" name="file" id="Resim" /> <br /> <input type="hidden" name="Id" value="@Model.id" class="form-control" multiple required /> <br /> <label>Resim Güncellemek İçin Bu Butonu Kullanın</label> <br /> <input type="submit" data-placement="top" data-toggle="tooltip" title="Resim Güncellemek İçin Bu Butonu Kullanın" class="btn btn-success" value="Resim Güncelle" /> </div> } <br /> <br /> <form method="post"> <div class="form-group"> <label>Mevcut Resim</label> <br /> <input type="hidden" name="İmg1" value="@Model.resim" class="form-control" multiple required /> <img src="http://admin.medyadapazar.com/\content\Haberİmg\@Model.resim.Split(';')[0]" alt="@Model.Baslik" style="height:200px;width:250px" class="avatar img-circle img-thumbnail" /> <div class="text-center" id="resimonizleme" style="display:none!important"> <h4 class="text-center">Resim Önizleme</h4> <img class="text-center" src="" id="SecilecResim" style="height:15rem!important" /> </div> </div> <div class="form-group row"> <label class=" col-md-3">Baslik</label> <div class="col-md-9 col-sm-9"> <input type="text" placeholder="Baslik" value="@Model.Baslik" name="Baslik" id="Baslik" class="form-control" /> </div> </div> <div class="form-group row"> <label class="col-md-3">Haber Tarihi</label> <div class="col-md-9 col-sm-9"> <input type="text" placeholder="HaberTarihi" disabled="disabled" value="@Model.tarih" id="HaberTarihi" name="HaberTarihi" class="form-control" /> </div> </div> <div class="form-group row"> <label class=" col-md-3">Haber İçerik</label> <div class="col-md-9 col-sm-9"> <textarea name="haber" rows="6" id="İcerik" required>@ViewBag.haber </textarea> @* rows kaç satır olacagını belirler*@ </div> </div> <input type="hidden" value="@Model.id" id="Id" name="Id" /> <div class="In_solid"></div> <div class="form-group"> <div class="col-md-9 offset-md-3"> <button type="submit" class="btn btn-success" id="KadroEkle"> Kaydet</button> <button type="reset" class="btn btn-primary">Temizle</button> <button type="button" class="btn btn-primary">İptal</button> </div> </div> </form> </div> </div> </div> </div> <script type="text/javascript"> $("#Resim").change(function () { ResimOku(this); }); function ResimOku(input) { if (input.files && input.files[0]) //eğer Dosya seçilmiş ise { var reader = new FileReader(); //seçilen Dosyayı Okul reader.onload = function (e) //seçilen Dosyayı img src içerisine ata resimonizleme { $("#resimonizleme").show(); $('#SecilecResim').attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } </script> <script type="text/javascript"> $("#KadroEkle").click(function () { tinyMCE.triggerSave(); //veri tabanına kaydedecegim ürünün bilgilerini oluşturuyoruz. var Kadro = { Baslik: $("#Baslik").val(), id: $("#Id").val(), haber: $("#İcerik").val(), } //üstteki data bizim Ürün ve bu ürüne ait bedenlerin listesi $.ajax({ type: "POST", //sayfadaki verileri Controller tarafına post yöntemi ile gönderecegiz. url: "/Haberler/guncelle", //hangi controller a hangi metoda gnderecegimizi yazıyoruz. /* Kullanmamız Gereken yöntem. Veriler Json tipine çevriliyor. */ //data: $.toJSON(urun), data: JSON.stringify(Kadro), //Urunler modeline dönüştürür. contentType: "application/json; charset=utf-8", dataType: "json", success: setTimeout(function () { window.location = "/Haberler/liste"; }, 1000), }); }) </script>