コード例 #1
0
        public PartialViewResult RenderMostBookPay()
        {
            F_Book book  = new F_Book();
            var    model = book.getAll();

            return(PartialView(model));
        }
コード例 #2
0
        public ActionResult Product(long id)
        {
            F_Category fctg = new F_Category();

            ViewBag.ListCategory = fctg.getAll();
            var model = new F_Book().FindEntity(id);

            ViewBag.Book = model;
            return(View());
        }
コード例 #3
0
        public ActionResult timkiemtheotacgia(long id)
        {
            var dsBook = new F_Book().getAll().Where(x => x.Author == id);

            ViewBag.Book = dsBook;
            F_Category fctg = new F_Category();

            ViewBag.ListCategory = fctg.getAll();
            return(View("Search"));
        }
コード例 #4
0
        public ActionResult timkiemtheogia(string begin, string end)
        {
            int u      = Convert.ToInt32(begin);
            int v      = Convert.ToInt32(end);
            var dsBook = new F_Book().getAll().Where(x => x.Price >= u && x.Price <= v);

            ViewBag.Book = dsBook;
            F_Category fctg = new F_Category();

            ViewBag.ListCategory = fctg.getAll();
            return(View("Search"));
        }
コード例 #5
0
        public ActionResult Checkout(string shipName, string mobile, string address, string email)
        {
            var order = new Order();

            order.CreateDate = DateTime.Now;
            order.ShipAdress = address;
            order.ShipMobile = mobile;
            order.ShipName   = shipName;
            order.ShipEmail  = email;

            try
            {
                var id = new F_Order().Insert(order);

                var cart = (Cart)Session["Cart"];

                var     detailDao = new F_Order_Detail();
                decimal total     = 0;
                foreach (var item in cart.ListItem)
                {
                    var orderDetail = new Order_Detail();
                    orderDetail.BookID = item.ItemID;
                    Book book = new F_Book().FindBook(item.ItemID);
                    orderDetail.Price    = book.PromotionPrice;
                    orderDetail.Quantity = item.Quantity;
                    orderDetail.OrderID  = Convert.ToInt32(id);
                    orderDetail.Quantity = item.Quantity;
                    detailDao.Insert(orderDetail);
                    total += Convert.ToInt32(orderDetail.Price) * Convert.ToInt32(orderDetail.Quantity);
                }

                order.TotalPrice = total;
                var  id1     = new F_Order().Update(order);
                Cart objCart = (Cart)Session["Cart"];
                objCart.GioHangRong();
                Session["Cart"] = objCart;
            }
            catch (Exception ex)
            {
                //ghi log
                return(RedirectToAction("/Loi"));
            }
            return(RedirectToAction("Index", "Home"));
        }
コード例 #6
0
        public ActionResult timkiemtheocategory(string query, int?page)
        {
            long?id = Convert.ToInt64(query);

            if (id == null)
            {
                id = Convert.ToInt64(Request.QueryString["query"]);
            }

            ViewBag.Title = "category=" + id + "&page=" + page;
            var listBook = new F_CategoryBook().getAll().Where(x => x.IDCategory == id).ToList();
            var dsBook   = new F_Book().getAll();
            var list     = (from book in listBook
                            join book1 in dsBook on book.IDBook equals book1.ID
                            select new Book
            {
                ID = book1.ID,
                Name = book1.Name,
                Image = book1.Image,
                Price = book1.Price
            });

            List <Book> u = new List <Book>();

            foreach (var v in list)
            {
                Book temp = new Book();
                temp.ID    = v.ID;
                temp.Name  = v.Name;
                temp.Price = v.NumberPage;
                temp.Image = v.Image;
                u.Add(temp);
            }
            ViewBag.Book = list;
            F_Category fctg = new F_Category();

            ViewBag.ListCategory = fctg.getAll();

            int pageSize   = 5;
            int pageNumber = (page ?? 1);

            return(View("Search", u.ToPagedList(pageNumber, pageSize)));
        }
コード例 #7
0
        public ActionResult Search(string query, int?page)
        {
            if (query == null)
            {
                query = "";
            }
            if (page == null)
            {
                page = 1;
            }
            var model = new F_Book().getAll().Where(x => x.Name.Contains(query)).OrderBy(x => x.ID).ToList();

            ViewBag.Title = "q=" + query + "&page=" + page;

            int pageSize   = 6;
            int pageNumber = (page ?? 1);

            F_Category fctg = new F_Category();

            ViewBag.ListCategory = fctg.getAll();
            return(View("Search", model.ToPagedList(pageNumber, pageSize)));
        }