// GET: Admin/OurChef
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new OurChefDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
Example #2
0
        // GET: About
        public ActionResult Index()
        {
            var about = new OurChefDao();

            ViewBag.ourchefT = about.ListOurChefT(1);
            ViewBag.ourchef  = about.ListOurChef(3);
            ViewBag.ourchefA = about.ListOurChefA(3);
            ViewBag.footer   = new ProductDao().ListFooter(6);
            ViewBag.about    = new AboutDao().ListAbout(6);
            return(View());
        }
        public ActionResult Create(OurChefs model)
        {
            if (ModelState.IsValid)
            {
                var dao = new OurChefDao();

                long id = dao.Insert(model);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "OurChef"));
                }
                else
                {
                    ModelState.AddModelError("", "Them OurChef thanh cong");
                }
            }
            return(View("Index"));
        }
        public ActionResult Edit(OurChefs model)
        {
            if (ModelState.IsValid)
            {
                var dao = new OurChefDao();

                if (!string.IsNullOrEmpty(model.Name))
                {
                    var result = dao.Update(model);
                    if (result)
                    {
                        return(RedirectToAction("Index", "OurChef"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Cap nhap thanh cong");
                    }
                }
            }
            return(View());
        }
        public ActionResult Edit(int id)
        {
            var user = new OurChefDao().ViewDetail(id);

            return(View(user));
        }