public void Remove(int id)
        {
            var feedbackdeleted = dt.Feedbacks.Find(id);

            dt.Feedbacks.Remove(feedbackdeleted);
            dt.SaveChanges();
        }
Esempio n. 2
0
        public bool ChangeStatus(int id)
        {
            var order = dt.Orders.Find(id);

            order.status = !order.status;
            dt.SaveChanges();
            return(order.status);
        }
Esempio n. 3
0
        public bool ChangeStatus(int id)
        {
            var aboutchange = dt.Abouts.Find(id);

            aboutchange.Status = !aboutchange.Status;
            dt.SaveChanges();
            return(aboutchange.Status);
        }
Esempio n. 4
0
 public void ChuyenDoi(List <Content> contents)
 {
     foreach (var item in contents)
     {
         var content = dt.Contents.Find(item.ContentID);
         content.MetaTitle = convertToUnSign3(item.ContentName).Replace(" ", "-").ToLower();
         dt.SaveChanges();
     }
 }
        public bool ChangeStatusProcess(int orderID, int productID)
        {
            var orderDetail = dt.OrderDetails.SingleOrDefault(x => x.OrderID == orderID && x.ProductID == productID);

            orderDetail.Trangthaixuli = !orderDetail.Trangthaixuli;
            dt.SaveChanges();

            return(orderDetail.Trangthaixuli);
        }
Esempio n. 6
0
 public int Create(Tag tag)
 {
     try
     {
         dt.Tags.Add(tag);
         dt.SaveChanges();
         return(1);
     }
     catch
     {
         return(0);
     }
 }
Esempio n. 7
0
        public int Edit(CustomerAccount customer)
        {
            var customerAccout = dt.CustomerAccounts.SingleOrDefault(x => x.Email == customer.Email);

            if (customerAccout == null)
            {
                return(0);
            }
            customerAccout.PassWord        = customer.PassWord;
            customerAccout.ConfirmPassWord = customer.ConfirmPassWord;
            dt.SaveChanges();
            return(1);
        }
 public int Create(MenuType menuType)
 {
     try
     {
         dt.MenuTypes.Add(menuType);
         dt.SaveChanges();
         return(1);
     }
     catch
     {
         return(0);
     }
 }
Esempio n. 9
0
 public long Insert(UserAccount entity)
 {
     try
     {
         dt.UserAccounts.Add(entity);
         dt.SaveChanges();
         return(1);
     }
     catch
     {
         return(0);
     }
 }
Esempio n. 10
0
 public bool InsertFeedback(Feedback feedback)
 {
     try
     {
         dt.Feedbacks.Add(feedback);
         dt.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 11
0
 public int Create(Slide slide)
 {
     try
     {
         slide.CreateDate = DateTime.Now;
         dt.Slides.Add(slide);
         dt.SaveChanges();
         return(1);
     }
     catch
     {
         return(0);
     }
 }
        public int Create(ProductCategory productCategory)
        {
            try
            {
                productCategory.MetaTitle = convertToUnSign3(productCategory.CategoryName).Replace(" ", "-").ToLower();

                dt.ProductCategories.Add(productCategory);
                dt.SaveChanges();
                return(1);
            }
            catch
            {
                return(0);
            }
        }
Esempio n. 13
0
        public long Create(Content content)
        {
            //xử lý alias
            if (string.IsNullOrEmpty(content.metaTitle))
            {
                content.metaTitle = StringHelper.ConvertToUnSign(content.name);
            }
            content.viewCount  = 0;
            content.createDate = DateTime.Now;
            db.Contents.Add(content);
            db.SaveChanges();

            if (!string.IsNullOrEmpty(content.tags))
            {
                string[] tags = content.tags.Split(',');
                foreach (var tag in tags)
                {
                    var  tagID    = StringHelper.ConvertToUnSign(tag);
                    bool existTag = CheckTag(tagID);
                    //insert vào bảng Tag
                    if (!existTag)
                    {
                        InsertTag(tagID, tag);
                    }

                    //insert vào bảng ContentTag
                    InsertContentTag(content.id, tagID);
                }
            }
            return(content.id);
        }
Esempio n. 14
0
 public bool Insert(OrderDetail detail)
 {
     try
     {
         db.OrderDetails.Add(detail);
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 15
0
        public bool ChangeStatus(int newsid)
        {
            var news = dt.News.Find(newsid);

            news.Status = !news.Status;
            dt.SaveChanges();
            return(news.Status);
        }
Esempio n. 16
0
 public bool Delete(int id)
 {
     try
     {
         var cate = db.Feedbacks.Find(id);
         db.Feedbacks.Remove(cate);
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 17
0
 public int Insert(Category cate)
 {
     db.Categories.Add(cate);
     db.SaveChanges();
     return(cate.id);
 }
Esempio n. 18
0
 public long Insert(Product product)
 {
     db.Products.Add(product);
     db.SaveChanges();
     return(product.id);
 }
Esempio n. 19
0
 public long Insert(User entity)
 {
     db.Users.Add(entity);
     db.SaveChanges();
     return(entity.id);
 }
Esempio n. 20
0
 public long Insert(Order order)
 {
     db.Orders.Add(order);
     db.SaveChanges();
     return(order.id);
 }
Esempio n. 21
0
 public int InsertFeedback(Feedback fb)
 {
     db.Feedbacks.Add(fb);
     db.SaveChanges();
     return(fb.id);
 }
Esempio n. 22
0
 public long Insert(Slide entity)
 {
     db.Slides.Add(entity);
     db.SaveChanges();
     return(entity.id);
 }
Esempio n. 23
0
 public long Insert(Menu entity)
 {
     db.Menus.Add(entity);
     db.SaveChanges();
     return(entity.id);
 }