Subscribe to Continue Downloading

Redirecting...
Trang chu 3 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

by Hữu Leein , on March 8, 2023

Choose Your Desired Option(s)

Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang chu 2 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

Trang chu 3 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

Trang chu 4 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

Trang chu 5 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang chu 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang chủ

 

Trang Tranh Ha Noi 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang Tranh Hà Nội

 

Trang chi tiet san pham 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang chi tiết sản phẩm

 

Gio hang 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Giỏ hàng

 

Trang San pham 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang Sản phẩm

 

Trang Tin tuc 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang Tin tức

 

Bai dang 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Bài đăng

 

Trang Chi tiet san pham 2 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang Chi tiết sản phẩm

 

Trang Quan ly san pham 副本 - Code C# đồ án website bán tranh thuê mô hình MVC+ báo cáo

 

Trang Quản lý sản phẩm

 

Code C# của một số chức năng chính

          Chức năng giỏ hàng

{

    [MyFilter]

    public class CartController : Controller

    {

        // GET: Cart

        private Web_Tranh_Theu db = new Web_Tranh_Theu();

        private const string CartSession = “CartSession”;

        public ActionResult Index()

        {

            var cart = (Cart)Session[CartSession];

            if (cart == null || cart.cartLines.Count == 0)

            {

                ViewBag.Message = “Giỏ hàng trống”;

            }

            return View(cart);

        }

        [HttpPost]

        public ActionResult AddItem(int product_Id, int quantity)

        {

            if (Session[“HoTen”] == null)

            {

                return Redirect(“/Home/Login”);

            }

            else

            {

                var cart = (Cart)Session[CartSession];

                if (cart == null)

                {

                    cart = new Cart();

                }

                if (cart.cartLines.Exists(x => x.productDto.Id == product_Id))

                {

                    var item = cart.cartLines.Find(x => x.productDto.Id == product_Id);

                     int slt = db.Products.Find(product_Id).Quantity;

                      if (item.quantity + quantity > slt)

                          item.quantity = slt;

                      else item.quantity += quantity;

                }

                else

                {

                    Product product = db.Products.Find(product_Id);

                    ProductDto productDto = new ProductDto(product);

                    cart.cartLines.Add(new CartItem(productDto,quantity));

                }

                Session[CartSession] = cart;

                Session[“CartLineTotal”] = cart.cartLines.Count();

            }

            return RedirectToAction(“Index”);

        }

        public ActionResult EditItem(int id, int quantity)

        {

            var cart = (Cart) Session[CartSession];

            string sl = “”;

            var item = cart.cartLines.FirstOrDefault(x => x.productDto.Id == id);

            item.quantity = quantity;

            sl = Convert.ToDecimal(item.getAmount()).ToString(“#,#”);

            return Json(new

            {

                status = true, sl

            }, JsonRequestBehavior.AllowGet);

        }

        public ActionResult DeleteItem(int id)

        {

            var cart = (Cart)Session[CartSession];

            var item = cart.cartLines.Find(p => p.productDto.Id.Equals(id));

            if(item != null)

            {

                cart.cartLines.Remove(item);

                @Session[“CartLineTotal”] = (int)cart.cartLines.Count;

            }

            Session[CartSession] = cart;

            return Json(new

            {

                status = true,

                cartline = @Session[“CartLineTotal”]

            }, JsonRequestBehavior.AllowGet);

        }

        public ActionResult DeleteAllItem()

        {

            var cart = (Cart)Session[CartSession];

            cart.cartLines.RemoveAll(p => p.getAmount() > 1);

            Session[CartSession] = cart;

            Session[“CartLineTotal”] = 0;

            return Json(new

            {

                status = true

            }, JsonRequestBehavior.AllowGet);

        }

    }

}

 

Chức năng thanh toán

 

{

    [MyFilter]

    public class CheckoutController : Controller

    {

        private Web_Tranh_Theu db = new Web_Tranh_Theu();

        private const string CartSession = “CartSession”;

        [HttpPost]

        public ActionResult Items_Error(string CartItems)

        {

            var cart = (Cart)Session[CartSession];

            if (cart == null || cart.cartLines.Count == 0)

            {

                return RedirectToAction(“index”);

            }

            var jsonCartItem = new JavaScriptSerializer().Deserialize<List<CartItem>>(CartItems);

            List<ItemError> itemErrors = new List<ItemError>();

            foreach (var item in jsonCartItem)

            {

                int sltQuantity = db.Products.Where(x => x.Product_Id == item.productDto.Id).Select(x => x.Quantity).SingleOrDefault();

                if (item.quantity > sltQuantity)

                {

                    var i = cart.cartLines.SingleOrDefault(x => x.productDto.Id == item.productDto.Id);

                    itemErrors.Add(new ItemError(i.productDto, sltQuantity, item.quantity));

                }

            }

            if (itemErrors.Count > 0)

            {

                return View(itemErrors);

            }

            else

            {

                int id_user = (int)Session[“idUser”];

                Account acc = (Account)db.Accounts.Where(a => a.Account_Id.Equals(id_user)).First();

                cart.customerDto = new CustomerDto(acc);

                Session[CartSession] = cart;

                return RedirectToAction(“Index”);

            }

        }

        public ActionResult Index()

        {

            var cart = (Cart)Session[CartSession];

            if (cart == null || cart.cartLines.Count == 0)

            {

                return Redirect(“/Cart/Index”);

            }

            return View(cart);

        }

        [HttpPost]

        public ActionResult Final_Checkout(CustomerDto customerDto)

        {

            var cart = (Cart)Session[CartSession];

            if (cart.cartLines.Count < 1)

            {

                return Redirect(“/Cart/Index”);

            }

            if (ModelState.IsValid)

            {

                Order order = new Order();

                order.Account_Id = (int)Session[“idUser”];

                order.Customer_Address = customerDto.Address;

                order.Customer_Phone = customerDto.Telephone;

                order.Status = true;

                order.Order_Date = DateTime.Now;

                order.Total_Amount = ((long)cart.cartLines.Sum(x => x.getAmount()));

                db.Orders.Add(order);

                foreach (var item in cart.cartLines)

                {

                    var product = db.Products.Find(item.productDto.Id);

                    product.Quantity -= item.quantity;

                    db.Entry(product).State = EntityState.Modified;

                    DetailProduct_Order detail = new DetailProduct_Order();

                    detail.Order_Id = order.Order_Id;

                    detail.Product_Id = item.productDto.Id;

                    detail.Order_Quantity = item.quantity;

                    detail.Order_Price = item.productDto.Price;

                    db.DetailProduct_Order.Add(detail); 

                }

                db.SaveChanges();

                cart.cartLines.RemoveAll(x => x.getAmount() > 0);

                Session[“CartLineTotal”] = 0;

                Session.Remove(CartSession);

                return View(cart);

            }

            cart.customerDto = customerDto;

            return View(“Index”,cart);

        }

    }

}

 

Chức năng cửa hàng sản phẩm

 

{

    public class ShopController : Controller

    {

        // GET: Shop

        private Web_Tranh_Theu db = new Web_Tranh_Theu();

        CategoriesDAO categoriesDAO = new CategoriesDAO();

        [RequireHttps]

        public ActionResult Index(int? page, int? size, int? Category_Id,

            string searchString, string CurrentSearch)

        {

            List<Product> products;

            if (searchString != null)

            {

                ViewBag.current_Filter = searchString;

                page = 1;

            }

            else

            {

                searchString = CurrentSearch;

            }

            if (!String.IsNullOrEmpty(searchString))

            {

                if (Category_Id == null || Category_Id == 0)

                {

                    products = db.Products.Where(p => p.Name.Contains(searchString)).ToList();

                }

                else products = db.Products.Where(p => p.Name.Contains(searchString) && p.Category_Id == Category_Id).ToList();

            }

            else

            {

                if (Category_Id == null || Category_Id == 0)

                {

                    products = db.Products.ToList();

                }

                else products = categoriesDAO.GetProductsByCategoryId(Category_Id);

            }

            List<Category> categories = categoriesDAO.GetAllCategoiries();

            int pageSize = (size ?? 5);

            int pageNumber = (page ?? 1);

            ViewBag.categories = categories;

            ViewBag.CurrentPage = pageNumber;

            ViewBag.CurrentSize = pageSize;

            ViewBag.current_Cate = Category_Id;

            ViewBag.TotalProducts = db.Products.ToList().Count;

            return View(products.ToPagedList(pageNumber, pageSize));

        }

        [HttpGet]

        public ActionResult Shop_Detail(int? id)

        {

            if(id == null)

            {

                return RedirectToAction(“Index”);

            }

            Product product = db.Products.Find(id);

            product.Product_Image = db.Product_Image.Where(pi => pi.Product_Id == id).ToList();

            var splq = db.Products.Where(p => p.Category_Id.Equals(product.Category_Id)

            && p.Product_Id != id).Take(4).ToList();

            ViewBag.sqlq =(List<Product>) splq;

            return View(product);

        }

    }

Download Category ,
Product Version
File Type ASAX, CS, SLN, DOCX, JS
File Size 45.5 MB
Developer
Documentation

Release Information

  • Released
    :

    March 8, 2023

  • Last Updated
    :

    March 8, 2023

  • Categories
    :
  • File Included
    :

    ASAX, CS, SLN, DOCX, JS

  • File Size
    :

    45.5 MB

Share Your Valuable Opinions

You must log in to submit a review.

  • Sign up
Password Strength Very Weak
Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.
We do not share your personal details with anyone.

Please wait a moment...

(Don't refresh or go back)