// GET: Admin/Bank
        public ActionResult Index()
        {
            BankDao         db   = new BankDao();
            List <nganhang> list = db.List();
            nganhang        type = new nganhang();

            ViewData["list"] = list;
            return(View());
        }
Ejemplo n.º 2
0
        public bool Update(nganhang entity)
        {
            var type = db.nganhangs.Find(entity.nh_id);

            //type.nh_id = entity.nh_id;
            type.nh_ten = entity.nh_ten;
            type.nh_ma  = entity.nh_ma;
            db.SaveChanges();
            return(true);
        }
 public ActionResult Update(nganhang model)
 {
     try
     {
         var type = new BankDao().Update(model);
         if (TempData["ModelSuccess"] == null)
         {
             TempData.Add("ModelSuccess", "Cập nhật thành công.");
         }
         return(RedirectToAction("Index", "Bank"));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     if (TempData["ModelErrors"] == null)
     {
         TempData.Add("ModelErrors", "Có lỗi xảy ra! Không thể cập nhật.");
     }
     return(RedirectToAction("Index", "Bank"));
 }
 public ActionResult Store(nganhang model)
 {
     try
     {
         BankDao db = new BankDao();
         db.Insert(model);
         if (TempData["ModelSuccess"] == null)
         {
             TempData.Add("ModelSuccess", "Thêm thành công.");
         }
         return(RedirectToAction("Index", "Bank"));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     if (TempData["ModelErrors"] == null)
     {
         TempData.Add("ModelErrors", "Có lỗi xảy ra! Không thể thêm.");
     }
     return(RedirectToAction("Index", "Bank"));
 }
Ejemplo n.º 5
0
 public int Insert(nganhang entity)
 {
     db.nganhangs.Add(entity);
     db.SaveChanges();
     return(entity.nh_id);
 }