internal bool RafDuzenle(Rafs model) { try { var duzen = _db.Rafs.First(x => x.ID == model.ID); duzen.RafAdi = model.RafAdi.Trim(); _db.SaveChanges(); return(true); } catch { return(false); } }
internal bool RafSil(Rafs model) { try { var sil = _db.Rafs.First(x => x.ID == model.ID); _db.Rafs.Remove(sil); _db.SaveChanges(); return(true); } catch { return(false); } }
public ActionResult RafSil(Rafs model) { if (ModelState.IsValid) { bool kontrol = _film.RafSil(model); if (kontrol) { return(RedirectToAction("RafListesi")); } else { return(RedirectToAction("HataBildirimi", new { Bilgi = "Raf Silinirken Bir Hata Oluştu" })); } } return(View(model)); }
public ActionResult RafDuzenle(Rafs model) { if (ModelState.IsValid) { bool kontrol = _film.RafDuzenle(model); if (kontrol) { return(RedirectToAction("RafListesi")); } else { return(RedirectToAction("HataBildirimi", new { Bilgi = "Raf Düzenleme İşleminde Hata Oluştu" })); } } return(View(model)); }
internal bool RafEkle(Rafs model) { try { model.RafAdi = model.RafAdi.Trim(); model.KayitTarihi = DateTime.Today; var raf = _db.Rafs.SingleOrDefault(x => x.RafAdi == model.RafAdi); if (raf != null) { return(true); } _db.Rafs.Add(model); _db.SaveChanges(); return(true); } catch { return(false); } }