//[HttpGet("haber/{id}/{title}", Name = "Oku")] public IActionResult Oku(int id) { var haber = new Haber(); try { haber = hrp.GetirHaberId(id); if (haber == null) { return(Redirect("/Hata/")); } else { haber.Hit += 1; hrp.Guncelle(haber); return(this.View(haber)); } } catch (System.Exception) { return(Redirect("/Hata/")); } //string friendlyTitle = FriendlyUrlHelper.GetFriendlyTitle(haber.Baslik); //if (!string.Equals(friendlyTitle, baslik, StringComparison.Ordinal)) //{ // return this.RedirectToRoutePermanent("Oku", new { id = id, title = friendlyTitle }); //} }
public IActionResult Duzenle(Haber model, IFormFile Resim) { if (ModelState.IsValid) { if (Resim != null) { var result = upload._fncResimYukleAsync(Resim); model.Resim = result.Result; } model.GuncellemeTarihi = Convert.ToDateTime(DateTime.Now); db.Guncelle(model); } ViewBag.Kat = dbkat.GetirHepsi(); return(View(model)); }