コード例 #1
0
        public ActionResult Detail(long id)
        {
            var bill = new BillDetailDao().ViewDetail(id);

            //ViewBag.Category = new ProductCategoryDao().ViewDetail(product.CategoryID.Value);
            return(View(bill));
        }
コード例 #2
0
        public bool Handle(Bill bill)
        {
            bool kq     = true;
            bool result = new BillDAO().InsertBill(bill);

            if (result)
            {
                foreach (var bdt in bill.ListBillDetail)
                {
                    bool rs = new BillDetailDao().InsertBillDetail(bdt);
                    if (rs)
                    {
                        continue;
                    }
                    else
                    {
                        kq = false;
                        MessageBox.Show("Lỗi");
                        break;
                    }
                }
            }
            else
            {
                kq = false;
            }
            return(kq);
        }
コード例 #3
0
        public ActionResult Index(int searchString = 0, int page = 1)
        {
            int pagesize = 4;
            var dao      = new BillDetailDao();
            var model    = dao.GetAllBillDetail(searchString, page, pagesize);

            return(View(model));
        }
コード例 #4
0
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new BillDetailDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
コード例 #5
0
 public ActionResult Edit(BillDetail BillDetail)
 {
     if (ModelState.IsValid)
     {
         var dao    = new BillDetailDao();
         var result = dao.Update(BillDetail);
         if (result)
         {
             return(RedirectToAction("Index", "BillDetail"));
         }
         else
         {
             ModelState.AddModelError("", "Modify successfully");
         }
     }
     return(View("Index"));
 }
コード例 #6
0
 public ActionResult Create(BillDetail BillDetail)
 {
     if (ModelState.IsValid)
     {
         var  dao = new BillDetailDao();
         long id  = dao.Insert(BillDetail);
         if (id > 0)
         {
             return(RedirectToAction("Index", "BillDetail"));
         }
         else
         {
             ModelState.AddModelError("", "Add BillDetail successfully");
         }
     }
     return(View("Index"));
 }
コード例 #7
0
        public ActionResult Edit(int id)
        {
            var BillDetail = new BillDetailDao().ViewDetail(id);

            return(View(BillDetail));
        }