// GET: CarManufacturerClient
        public ActionResult Index(int id)
        {
            var listHX = new CarManufacturerDAO().ListOf();

            ViewBag.HX = listHX;

            var listTL = new CategoryDAO().ListOf();

            ViewBag.TL = listTL;

            var listPK = new CylinderCapacityDAO().ListOf();

            ViewBag.PK = listPK;

            var listCL = new ColorDAO().ListOf();

            ViewBag.CL = listCL;

            var listNews = new NewsDAO().ListAll();

            ViewBag.New = listNews;

            var listNewPr = new ProductDAO().ListNewPro();

            ViewBag.Product = listNewPr;

            var listAllPr = new ProductDAO().ListByIDCar(id);

            ViewBag.ALLPro = listAllPr;

            return(View());
        }
Ejemplo n.º 2
0
        // GET: Admin/CarManufacturerAdmin
        public ActionResult Index(string search, int page = 1, int pageSize = 5)
        {
            var iplAcc = new CarManufacturerDAO();
            var model  = iplAcc.ListAllPage(search, page, pageSize);

            ViewBag.Search = search;

            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult Create(FeedbackModel model)
        {
            if (ModelState.IsValid)
            {
                var login = new FeedbackDAO();

                var user = new Feedback();
                user.id_User    = model.User_ID;
                user.id_Product = model.Product_ID;
                user.star       = model.Star;
                user.note       = model.Note;

                var result = login.Insert(user);
                if (result > 0)
                {
                    ViewBag.Success = "Đăng đánh giá bình luận thành công.";
                    return(RedirectToAction("Index", "ProductClient"));
                }
                else
                {
                    ModelState.AddModelError("", "Đăng đánh giá bình luận không thành công !!!");
                }
            }
            var listHX = new CarManufacturerDAO().ListOf();

            ViewBag.HX = listHX;

            var listTL = new CategoryDAO().ListOf();

            ViewBag.TL = listTL;

            var listPK = new CylinderCapacityDAO().ListOf();

            ViewBag.PK = listPK;

            var listCL = new ColorDAO().ListOf();

            ViewBag.CL = listCL;

            var listAllPr = new ProductDAO().ListAll();

            ViewBag.Pr = listAllPr;

            var listNews = new NewsDAO().ListAll();

            ViewBag.New = listNews;

            var listNewPr = new ProductDAO().ListNewPro();

            ViewBag.Product = listNewPr;

            return(View("Index"));
        }
        // GET: HomeClient
        public ActionResult Index()
        {
            var iplProduct = new ProductDAO();
            var model      = iplProduct.ListAll();

            ViewBag.Product = model;

            var iplCar           = new CarManufacturerDAO();
            var carManufacturers = iplCar.ListAll();

            ViewBag.Car = carManufacturers;

            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult Edit(CarManufacturer carManufacturer)
        {
            if (ModelState.IsValid)
            {
                var dao = new CarManufacturerDAO();

                var result = dao.Update(carManufacturer);
                if (result)
                {
                    return(RedirectToAction("Index", "CarManufacturerAdmin"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật thất bại");
                }
            }
            return(View("Index"));
        }
Ejemplo n.º 6
0
        public ActionResult Create(CarManufacturer cm)
        {
            if (ModelState.IsValid)
            {
                var dao = new CarManufacturerDAO();

                long id = dao.Insert(cm);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "CarManufacturerAdmin"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm mới thất bại");
                }
            }
            return(View());
        }
Ejemplo n.º 7
0
        // GET: Admin/Product/Create
        public ActionResult Create()
        {
            CarManufacturerDAO hx = new CarManufacturerDAO();
            var hxList            = hx.ListOf();

            CategoryDAO lx     = new CategoryDAO();
            var         lxList = lx.ListOf();

            CylinderCapacityDAO dtxl = new CylinderCapacityDAO();
            var dtxlList             = dtxl.ListOf();

            ColorDAO mx     = new ColorDAO();
            var      mxList = mx.ListOf();

            ViewBag.HX   = hxList;
            ViewBag.LX   = lxList;
            ViewBag.DTXL = dtxlList;
            ViewBag.MX   = mxList;

            return(View());
        }
Ejemplo n.º 8
0
        // GET: ProductClient/Details/5
        public ActionResult Details(int id)
        {
            var listHX = new CarManufacturerDAO().ListOf();

            ViewBag.HX = listHX;

            var listTL = new CategoryDAO().ListOf();

            ViewBag.TL = listTL;

            var listCL = new ColorDAO().ListOf();

            ViewBag.CL = listCL;

            var listAllPr = new ProductDAO().ListAll();

            ViewBag.Pr = listAllPr;

            var model = new FeedbackDAO().ListNewFb(id);
            List <FeedbackModel> listFb = new List <FeedbackModel>();

            foreach (var item in model)
            {
                var newFB = new FeedbackModel();
                newFB.ID         = item.id;
                newFB.Product_ID = item.id_Product;
                newFB.User_ID    = item.id_User;
                newFB.User_Name  = item.User == null ? string.Empty : item.User.displayname;
                newFB.Star       = item.star;
                newFB.Note       = item.note;
                listFb.Add(newFB);
            }
            ViewBag.Feedback = listFb;

            var pr = new ProductDAO().ViewDetail(id);

            return(View(pr));
        }
Ejemplo n.º 9
0
        // GET: Admin/Product/Edit/5
        public ActionResult Edit(int id)
        {
            var sp = new ProductDAO().ViewDetail(id);

            CarManufacturerDAO hx = new CarManufacturerDAO();
            var hxList            = hx.ListOf();

            CategoryDAO lx     = new CategoryDAO();
            var         lxList = lx.ListOf();

            CylinderCapacityDAO dtxl = new CylinderCapacityDAO();
            var dtxlList             = dtxl.ListOf();

            ColorDAO mx     = new ColorDAO();
            var      mxList = mx.ListOf();

            ViewBag.HX   = hxList;
            ViewBag.LX   = lxList;
            ViewBag.DTXL = dtxlList;
            ViewBag.MX   = mxList;

            return(View(sp));
        }
Ejemplo n.º 10
0
        // GET: ProductClient
        public ActionResult Index(string search, int page = 1, int pageSize = 20)
        {
            var listHX = new CarManufacturerDAO().ListOf();

            ViewBag.HX = listHX;

            var listTL = new CategoryDAO().ListOf();

            ViewBag.TL = listTL;

            var listPK = new CylinderCapacityDAO().ListOf();

            ViewBag.PK = listPK;

            var listCL = new ColorDAO().ListOf();

            ViewBag.CL = listCL;

            var listNews = new NewsDAO().ListAll();

            ViewBag.New = listNews;

            var listNewPr = new ProductDAO().ListNewPro();

            ViewBag.Product = listNewPr;

            //var listAllPr = new ProductDAO().ListOf();
            //ViewBag.ALLPro = listAllPr;

            var iplAcc = new ProductDAO();
            var model  = iplAcc.ListAllPage(search, page, pageSize);

            ViewBag.Search = search;

            return(View(model));
        }
Ejemplo n.º 11
0
        // GET: Admin/CarManufacturerAdmin/Edit/5
        public ActionResult Edit(int id)
        {
            var carManufacturer = new CarManufacturerDAO().Detail(id);

            return(View(carManufacturer));
        }
Ejemplo n.º 12
0
        // GET: Admin/HomeAdmin
        public ActionResult Index()
        {
            var listProduct = new ProductDAO().ListNewAD();
            var listPro     = new ProductDAO().ListOf();

            ViewBag.Model = listPro.Count();

            List <ProductAdminModel> listP = new List <ProductAdminModel>();

            foreach (var item in listProduct)
            {
                var newP = new ProductAdminModel();
                newP.Id             = item.id;
                newP.Name           = item.name;
                newP.ManufacterId   = item.id_CarManufacturer;
                newP.ManufacterName = item.CarManufacturer == null ? string.Empty : item.CarManufacturer.name;
                newP.Price          = item.price;
                newP.Number         = item.number;
                newP.Image          = item.imagemain;
                listP.Add(newP);
            }
            ViewBag.Product = listP;

            var listAcc = new AccountDAO();
            var acc     = listAcc.ListAll();

            ViewBag.Acc = acc;

            var listUsers = new UserDAO().ListAll();

            ViewBag.User = listUsers;

            var listNews = new NewsDAO().ListNewAdmin();

            ViewBag.News = listNews;

            var listContact = new ContactDAO().ListAll();

            ViewBag.Contact = listContact;

            var iplAcc = new FeedbackDAO();
            var fb     = iplAcc.ListOf();
            List <FeedbackAdminModel> listFB = new List <FeedbackAdminModel>();

            foreach (var item in fb)
            {
                var newFb = new FeedbackAdminModel();
                newFb.ID            = item.id;
                newFb.User_ID       = item.id_User;
                newFb.User_Name     = item.User == null ? string.Empty : item.User.displayname;
                newFb.Product_ID    = item.id_Product;
                newFb.Product_Image = item.Product == null ? string.Empty : item.Product.imagemain;
                newFb.Star          = item.star;
                newFb.Note          = item.note;
                listFB.Add(newFb);
            }
            ViewBag.Feedback = listFB;

            var order = new OrderDAO().ListOf();

            ViewBag.Order = order.Count();
            ViewBag.Price = order.Sum(x => x.amount).ToString("N0");

            var car = new CarManufacturerDAO().ListOf();

            ViewBag.Car = car.Count();


            return(View());
        }