Пример #1
0
 public ActionResult Edit(Bill Bill)
 {
     if (ModelState.IsValid)
     {
         var dao    = new BillDao();
         var result = dao.Update(Bill);
         if (result)
         {
             return(RedirectToAction("Index", "Bill"));
         }
         else
         {
             ModelState.AddModelError("", "Modify Bill successfully");
         }
     }
     return(View("Index"));
 }
Пример #2
0
        public ActionResult Edit(Order bill1)
        {
            if (ModelState.IsValid)
            {
                var dao = new BillDao();

                var result = dao.Update(bill1);
                if (result)
                {
                    return(RedirectToAction("Index", "Bill"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật thành công");
                }
            }
            return(RedirectToAction("Index", "Bill"));
        }
Пример #3
0
 public bool Update(BillUpdateForm bill)
 {
     ISqlMapper mapper = MapperHelper.GetMapper();
     BillDao dao = new BillDao(mapper);
     return dao.Update(bill);
 }
Пример #4
0
 public bool Update(BillModel model)
 {
     if (model == null) throw new Exception("model不能为null");
     if (model.Bill == null) throw new Exception("bill不能为null");
     if (string.IsNullOrEmpty(model.Bill.ID)) throw new Exception("Bill.ID不能为空");
     ISqlMapper mapper = MapperHelper.GetMapper();
     BillDao billdao = new BillDao(mapper);
     OtherFeeBillDao ofbdao = new OtherFeeBillDao(mapper);
     billdao.Update(new BillUpdateForm
     {
         Entity = new Bill
         {
             ShouldPay = model.Bill.ShouldPay,
             Payed = model.Bill.Payed,
         },
         BillQueryForm = new BillQueryForm { ID = model.Bill.ID },
     });
     if (model.OtherFeeBill != null)
     {
         foreach (var ofb in model.OtherFeeBill)
         {
             if (ofb.OtherFeeBill == null || string.IsNullOrEmpty(ofb.OtherFeeBill.ID)) continue;
             ofbdao.Update(new OtherFeeBillUpdateForm
             {
                 Entity = new OtherFeeBill
                 {
                     StartValue = ofb.OtherFeeBill.StartValue,
                     EndValue = ofb.OtherFeeBill.EndValue,
                     Fee = ofb.OtherFeeBill.Fee,
                 },
                 OtherFeeBillQueryForm = new OtherFeeBillQueryForm { ID = ofb.OtherFeeBill.ID },
             });
         }
     }
     return true;
 }