Ejemplo n.º 1
0
 public ActionResult Edit(OnlinePaying onlinePaying)
 {
     if (ModelState.IsValid)
     {
         var service = new OnlinePayingService();
         var result  = service.Update(onlinePaying);
         if (result)
         {
             SetAlert("Cập nhật thanh toán trực tiếp thành công!", "success");
             return(RedirectToAction("Index", "OnlinePayingAdmin"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật thanh toán trực tuyến thất bại!");
         }
     }
     SetViewBagMethod(onlinePaying.Method);
     return(View("Index"));
 }
Ejemplo n.º 2
0
 public ActionResult CreateOnline(OnlinePaying onlinePaying)
 {
     if (ModelState.IsValid)
     {
         var service = new OnlinePayingService();
         int id      = service.Insert(onlinePaying);
         if (id > 0)
         {
             SetAlert("Thêm thanh toán trực tiếp thành công!", "success");
             return(RedirectToAction("Index", "OnlinePayingAdmin"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm thanh toán trực tuyến mới thất bại!");
         }
     }
     SetViewBagMethod(onlinePaying.Method);
     return(View("Index"));
 }
Ejemplo n.º 3
0
        public bool Update(OnlinePaying entity)
        {
            try
            {
                var onlinePaying = db.OnlinePayings.Find(entity.ID);
                onlinePaying.Method      = entity.Method;
                onlinePaying.NamePay     = entity.NamePay;
                onlinePaying.NameAccount = entity.NameAccount;
                onlinePaying.CodeAccount = entity.CodeAccount;
                onlinePaying.Address     = entity.Address;
                onlinePaying.CreatedBy   = entity.CreatedBy;
                onlinePaying.CreatedDate = DateTime.Now;

                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
 public int Insert(OnlinePaying entity)
 {
     db.OnlinePayings.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }