Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        public TinTuc gettins(int id)
        {
            TinTuc a = (from c in justshop.TinTucs where c.MaTin == id select c).SingleOrDefault();

            return(a);
        }