コード例 #1
0
 public ActionResult Edit(LoaiSach collection)
 {
     try
     {
         if (ModelState.IsValid)
         {
             // TODO: Add insert logic here
             var dao    = new LoaiSachDao();
             var result = dao.Update(collection);
             if (result)
             {
                 SetAlert("Sửa thành công", "success");
                 return(RedirectToAction("Index", "LoaiSach"));
             }
             else
             {
                 ModelState.AddModelError("", "Cập nhật sản phẩm không thành công");
             }
         }
         return(View(collection));
     }
     catch
     {
         return(View("Index"));
     }
 }
コード例 #2
0
 public ActionResult Create(LoaiSach collection)
 {
     try
     {
         if (ModelState.IsValid)
         {
             // TODO: Add insert logic here
             var  dao = new LoaiSachDao();
             long id  = dao.Insert(collection);
             if (id > 0)
             {
                 SetAlert("Thêm thành công", "success");
                 return(RedirectToAction("Index", "LoaiSach"));
             }
             else
             {
                 ModelState.AddModelError("", "Thêm sản phẩm không thành công");
             }
         }
         return(View(collection));
     }
     catch
     {
         return(View("Index"));
     }
 }
コード例 #3
0
ファイル: SachController.cs プロジェクト: kienp2901/BookShop
        // GET: Admin/Sach/Create
        public ActionResult Create()
        {
            LoaiSachDao lsp1 = new LoaiSachDao();
            var         lSp1 = lsp1.ListOf();

            ViewBag.LSP = lSp1;
            return(View());
        }
コード例 #4
0
        // GET: Admin/LoaiSach
        //public ActionResult Index()
        //{
        //    var ls1 = new LoaiSachModel();
        //    var ls2 = ls1.ListAll();
        //    return View(ls2);
        //}



        public ActionResult Index(string searchString, int page = 1, int pagesize = 5)
        {
            //var iplCate = new SachModel();
            //var model = iplCate.ListAll();
            var dao   = new LoaiSachDao();
            var model = dao.ListAllPaging(searchString, page, pagesize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
コード例 #5
0
ファイル: SachController.cs プロジェクト: kienp2901/BookShop
        public ActionResult Edit(int id)
        {
            LoaiSachDao lsp = new LoaiSachDao();
            var         lSp = lsp.ListOf();



            ViewBag.LSP = lSp;

            SachDao dao = new SachDao();
            var     sp  = dao.Detail(id);

            return(View(sp));
        }
コード例 #6
0
        public ActionResult Edit(int id)
        {
            var Loaisach = new LoaiSachDao().ViewDetails(id);

            return(View(Loaisach));
        }