Пример #1
0
        public JsonResult CreateProduct(Product pr)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            Product temp            = db.Product.Find(pr.maSanPham);

            if (temp == null)
            {
                Product pro = new Product();
                pro.maSanPham     = pr.maSanPham;
                pro.moTa          = pr.moTa;
                pro.giaSanPham    = pr.giaSanPham;
                pro.chatLieu      = pr.chatLieu;
                pro.loaiSanPhamMa = pr.loaiSanPhamMa;
                pro.soLuongDatMua = 0;
                pro.mauSac        = pr.mauSac;
                pro.urlAnh        = pr.urlAnh;
                pro.tenSanPham    = pr.tenSanPham;
                db.Product.Add(pro);
                db.SaveChanges();
                return(Json(new
                {
                    status = true
                }));
            }
            return(Json(new
            {
                status = false
            }));
        }
Пример #2
0
        public JsonResult loadChiTiet(string id)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            GroupDetail          gr = db.GroupDetail.Find(id);

            return(Json(new
            {
                data = gr.nhomMa
            }));
        }
Пример #3
0
        public JsonResult DeleteProduct(string maSanPham)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            Product pr = db.Product.Find(maSanPham);

            if (pr != null)
            {
                db.Product.Remove(pr);
                db.SaveChanges();
            }
            return(Json(new
            {
                status = true
            }));
        }
Пример #4
0
        public JsonResult DeleteGroupDetail(string id)
        {
            FashionShopDbContext db       = new FashionShopDbContext();
            GroupDetail          grDetail = db.GroupDetail.Find(id);

            if (grDetail != null)
            {
                db.GroupDetail.Remove(grDetail);
                db.SaveChanges();
            }
            return(Json(new
            {
                status = true
            }));
        }
Пример #5
0
        public ActionResult Register(User us)
        {
            FashionShopDbContext db = new FashionShopDbContext();

            if (ModelState.IsValid)
            {
                //Thêm dữ liệu vào bảng User
                db.User.Add(us);

                //Lưu vào CSDL
                db.SaveChanges();
                ViewBag.ThongBao = "Đăng kí thành công";
            }
            return(View());
        }
Пример #6
0
        public JsonResult UpdateGroupPr(string maNhom, string tenNhom, string tittle)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            GroupPr gr = db.GroupPr.Find(maNhom);

            if (gr != null)
            {
                gr.tenNhom     = tenNhom;
                gr.meta_tittle = tittle;
                db.SaveChanges();
            }
            return(Json(new
            {
                status = true
            }));
        }
Пример #7
0
        public JsonResult UpdateGroupDetail(string maLoai, string tenLoai, string tittle, string maNhom)
        {
            FashionShopDbContext db       = new FashionShopDbContext();
            GroupDetail          grDetail = db.GroupDetail.Find(maLoai);

            if (grDetail != null)
            {
                grDetail.tenLoaiSanPham = tenLoai;
                grDetail.meta_tittle    = tittle;
                grDetail.nhomMa         = maNhom;
                db.SaveChanges();
            }
            return(Json(new
            {
                status = true
            }));
        }
Пример #8
0
        public JsonResult UpdateProduct(Product product)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            Product pr = db.Product.Find(product.maSanPham);

            if (pr != null)
            {
                pr.tenSanPham    = product.tenSanPham;
                pr.soLuongDatMua = product.soLuongDatMua;
                pr.moTa          = product.moTa;
                pr.mauSac        = product.mauSac;
                pr.loaiSanPhamMa = product.loaiSanPhamMa;
                pr.giaSanPham    = product.giaSanPham;
                pr.chatLieu      = product.chatLieu;
                db.SaveChanges();
            }
            return(Json(new
            {
                status = true
            }));
        }
Пример #9
0
        public JsonResult CreateGroupDetail(string maLoai, string tenLoai, string tittle, string manhom)
        {
            FashionShopDbContext db   = new FashionShopDbContext();
            GroupDetail          temp = db.GroupDetail.Find(maLoai);

            if (temp == null)
            {
                var list = db.GroupDetail.Where(x => x.meta_tittle == tittle).ToList();
                if (list.Count() == 0)
                {
                    GroupDetail grDetail = new GroupDetail();
                    grDetail.maLoaiSanPham  = maLoai;
                    grDetail.tenLoaiSanPham = tenLoai;
                    grDetail.meta_tittle    = tittle;
                    grDetail.nhomMa         = manhom;
                    db.GroupDetail.Add(grDetail);
                    db.SaveChanges();
                    return(Json(new
                    {
                        status = 1
                    }));
                }
                else
                {
                    return(Json(new
                    {
                        status = 3
                    }));
                }
            }
            else
            {
                return(Json(new
                {
                    status = 2
                }));
            }
        }
Пример #10
0
        public JsonResult DeleteGroupPr(string id)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            GroupPr gr = db.GroupPr.Find(id);
            int     st = 1;

            if (gr != null)
            {
                try
                {
                    db.GroupPr.Remove(gr);
                    db.SaveChanges();
                }
                catch
                {
                    st = 2;
                }
            }
            return(Json(new
            {
                status = st
            }));
        }
Пример #11
0
        public JsonResult CreateGroupPr(string maNhom, string tenNhom, string tittle)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            GroupPr temp            = db.GroupPr.Find(maNhom);

            if (temp == null)
            {
                var list = db.GroupPr.Where(x => x.meta_tittle == tittle).ToList();
                if (list.Count() == 0)
                {
                    GroupPr gr = new GroupPr();
                    gr.maNhom      = maNhom;
                    gr.tenNhom     = tenNhom;
                    gr.meta_tittle = tittle;
                    db.GroupPr.Add(gr);
                    db.SaveChanges();
                    return(Json(new
                    {
                        status = 1
                    }));
                }
                else
                {
                    return(Json(new
                    {
                        status = 3
                    }));
                }
            }
            else
            {
                return(Json(new
                {
                    status = 2
                }));
            }
        }
Пример #12
0
 public adminGroupDao()
 {
     db = new FashionShopDbContext();
 }
Пример #13
0
 public AdminDAO()
 {
     db = new FashionShopDbContext();
 }
Пример #14
0
 public GroupDetailDao()
 {
     db = new FashionShopDbContext();
 }
Пример #15
0
 public OrderDetailDao()
 {
     db = new FashionShopDbContext();
 }
Пример #16
0
 public UserDAO()
 {
     db = new FashionShopDbContext();
 }
Пример #17
0
 public ProductDAO()
 {
     db = new FashionShopDbContext();
 }
Пример #18
0
 public SlideDAO()
 {
     db = new FashionShopDbContext();
 }
Пример #19
0
 public adminProductDao()
 {
     db = new FashionShopDbContext();
 }
Пример #20
0
 public HomeController(FashionShopDbContext context, IHttpContextAccessor httpContextAccessor)
 {
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
 }
Пример #21
0
 public FeedBackDao()
 {
     db = new FashionShopDbContext();
 }
Пример #22
0
 public ProductsDao()
 {
     db = new FashionShopDbContext();
 }
Пример #23
0
 public MenuDao()
 {
     db = new FashionShopDbContext();
 }
Пример #24
0
 public AdminController(FashionShopDbContext context)
 {
     _context = context;
 }
Пример #25
0
 public AccountModel()
 {
     context = new FashionShopDbContext();
 }
Пример #26
0
 public ProductCategoryDao()
 {
     db = new FashionShopDbContext();
 }
Пример #27
0
 public ReceiptDao()
 {
     db = new FashionShopDbContext();
 }