public bool addTinTuc(string tieude, string noidung, string anh) { TinTuc a = new TinTuc(); a.TieuDe = tieude; a.NoiDung = noidung; a.Anh = anh; justshop.TinTucs.Add(a); justshop.SaveChanges(); return(true); }
public bool deleteTinTuc(int id) { TinTuc a = (from c in justshop.TinTucs where c.MaTin == id select c).SingleOrDefault(); if (a != null) { justshop.TinTucs.Remove(a); justshop.SaveChanges(); return(true); } return(false); }
public bool UpdateTinTuc(int id, string tieude, string noidung, string anh) { TinTuc a = (from c in justshop.TinTucs where c.MaTin == id select c).SingleOrDefault(); if (a != null) { a.Anh = anh; a.TieuDe = tieude; a.NoiDung = noidung; justshop.SaveChanges(); return(true); } return(false); }
public TinTuc gettins(int id) { TinTuc a = (from c in justshop.TinTucs where c.MaTin == id select c).SingleOrDefault(); return(a); }