Exemple #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
            }));
        }
Exemple #2
0
        public JsonResult loadChiTiet(string id)
        {
            FashionShopDbContext db = new FashionShopDbContext();
            GroupDetail          gr = db.GroupDetail.Find(id);

            return(Json(new
            {
                data = gr.nhomMa
            }));
        }
Exemple #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
            }));
        }
        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
            }));
        }
        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());
        }
        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
            }));
        }
        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
            }));
        }
Exemple #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
            }));
        }
        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
                }));
            }
        }
        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
            }));
        }
        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
                }));
            }
        }
Exemple #12
0
 public adminGroupDao()
 {
     db = new FashionShopDbContext();
 }
Exemple #13
0
 public AdminDAO()
 {
     db = new FashionShopDbContext();
 }
Exemple #14
0
 public GroupDetailDao()
 {
     db = new FashionShopDbContext();
 }
 public OrderDetailDao()
 {
     db = new FashionShopDbContext();
 }
Exemple #16
0
 public UserDAO()
 {
     db = new FashionShopDbContext();
 }
Exemple #17
0
 public ProductDAO()
 {
     db = new FashionShopDbContext();
 }
Exemple #18
0
 public SlideDAO()
 {
     db = new FashionShopDbContext();
 }
Exemple #19
0
 public adminProductDao()
 {
     db = new FashionShopDbContext();
 }
 public HomeController(FashionShopDbContext context, IHttpContextAccessor httpContextAccessor)
 {
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
 }
Exemple #21
0
 public FeedBackDao()
 {
     db = new FashionShopDbContext();
 }
Exemple #22
0
 public ProductsDao()
 {
     db = new FashionShopDbContext();
 }
Exemple #23
0
 public MenuDao()
 {
     db = new FashionShopDbContext();
 }
Exemple #24
0
 public AdminController(FashionShopDbContext context)
 {
     _context = context;
 }
Exemple #25
0
 public AccountModel()
 {
     context = new FashionShopDbContext();
 }
 public ProductCategoryDao()
 {
     db = new FashionShopDbContext();
 }
Exemple #27
0
 public ReceiptDao()
 {
     db = new FashionShopDbContext();
 }