示例#1
0
 public ActionResult Payment(Account account, long IdOrderAD, decimal Money, string TradeCode)
 {
     if (ModelState.IsValid)
     {
         var dao  = new BillAdDAO();
         var bill = new BillAd();
         bill.Address     = account.Address;
         bill.CMND_ID     = account.CMND;
         bill.CreateDate  = DateTime.Now;
         bill.IdOrderAd   = IdOrderAD;
         bill.Money       = Money;
         bill.NameCus     = account.Name;
         bill.Phone       = account.Phone;
         bill.TradingCode = TradeCode;
         long id = dao.Insert(bill);
         if (id > 0)
         {
             var IdAds = new OrderAdvertisementDAO().UpdateStatusComplete(IdOrderAD);
             if (IdAds > 0)
             {
                 new advertisementDAO().ActiveAd(IdAds);
             }
             setAlert("Đã thanh toán thành công", "success");
             return(RedirectToAction("Index", "Advertisement"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm tài khoản thất bại");
         }
     }
     return(View("Index"));
 }
示例#2
0
 public long Insert(BillAd bill)
 {
     db.BillAds.Add(bill);
     db.SaveChanges();
     return(bill.ID);
 }