예제 #1
0
        public ActionResult Index(string idOrder)
        {
            var order_Details = db.Order_Details.Where(x => x.OrderID == idOrder).Include(o => o.Orders).Include(o => o.Products);
            var order         = db.Orders.Single(x => x.OrderID == idOrder);

            order.Xem = true;
            db.SaveChanges();

            return(View(order_Details.ToList()));
        }
        public ActionResult Create([Bind(Include = "CategoryFatherID,CategoryName,icon")] Category_Fathers category_Fathers)
        {
            if (ModelState.IsValid)
            {
                db.Category_Fathers.Add(category_Fathers);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category_Fathers));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "TenVT,MoTa")] VaiTros vaiTros)
        {
            if (ModelState.IsValid)
            {
                db.VaiTros.Add(vaiTros);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vaiTros));
        }
        // GET: Admin/Lienlacs
        public ActionResult Index()
        {
            var ds = db.Lienlac.Where(x => x.Xem == false).ToList();

            foreach (var item in ds)
            {
                item.Xem = true;
                db.SaveChanges();
            }
            return(View(db.Lienlac.ToList()));
        }
        public ActionResult Create([Bind(Include = "CustomerID,Address,CustomerName,TenDN,Email,MatKhau,phonenumber,Picture")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customers);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customers));
        }
예제 #6
0
        public ActionResult Create([Bind(Include = "CategoryChildID,CategoryName,CategoryFatherID")] Category_Childs category_Childs)
        {
            if (ModelState.IsValid)
            {
                db.Category_Childs.Add(category_Childs);
                db.SaveChanges();
                return(RedirectToAction("Index", "Category_Childs", new { idcha = category_Childs.CategoryFatherID }));
            }

            ViewBag.CategoryFatherID = new SelectList(db.Category_Fathers, "CategoryFatherID", "CategoryName", category_Childs.CategoryFatherID);
            return(View(category_Childs));
        }
        public ActionResult Edit(Employees employees)
        {
            if (ModelState.IsValid)
            {
                db.Entry(employees).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.a = db.VaiTros.ToList();

            return(View(employees));
        }
예제 #8
0
 public bool insert(GioHang giohang)
 {
     try
     {
         db.GioHangs.Add(giohang);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #9
0
 public bool Delete(int id)
 {
     try
     {
         var data = db.DonHangs.Find(id);
         db.DonHangs.Remove(data);
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #10
0
        public int Insert(Taikhoan entity)
        {
            var user = db.Taikhoans.SingleOrDefault(x => x.Username == entity.Username);

            if (user == null)
            {
                db.Taikhoans.Add(entity);
                db.SaveChanges();
                return(1);
            }
            else if (user.Username == entity.Username)
            {
                return(-1);
            }
            else if (user.Email == entity.Email)
            {
                return(-2);
            }
            else
            {
                return(0);
            }
        }
예제 #11
0
 public bool DeleteBoNho(int id)
 {
     try
     {
         var user = db.BoNhoes.Find(id);
         db.BoNhoes.Remove(user);
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #12
0
 public bool Ram(Ram ram)
 {
     try
     {
         var data = db.Rams.Find(ram.ID_R);
         data.Ten   = ram.Ten;
         data.MaLSP = ram.MaLSP;
         data.STT   = ram.STT;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #13
0
 public int InsertFeedBack(Feedback fb)
 {
     db.Feedbacks.Add(fb);
     db.SaveChanges();
     return(fb.FeedbackID);
 }
예제 #14
0
 //public List<LoaiSanPham> loaiSanPhams()
 //{
 //    return db.LoaiSanPhams.Where(x=>x.LSPParentID==null).ToList();
 //}
 //public List<LoaiSanPham> loaiSanPhamsiem(int id)
 //{
 //    return db.LoaiSanPhams.Where(x => x.LSPParentID == id).ToList();
 //}
 public bool LoaiSanPham(LoaiSanPham loaiSanPham)
 {
     try
     {
         db.LoaiSanPhams.Add(loaiSanPham);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }