Exemplo n.º 1
0
        public bool Create(GiaVeSo entity)
        {
            try
            {
                db.GiaVeSo.Add(entity);
                db.SaveChanges();
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
 public ActionResult Edit(GiaVeSo model)
 {
     if (ModelState.IsValid)
     {
         if (GiaVeSoDao.Instance.Update(model))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật đại lý không thành công");
         }
     }
     return(View(model));
 }
Exemplo n.º 3
0
 public ActionResult Create(GiaVeSo entity)
 {
     if (ModelState.IsValid)
     {
         if (GiaVeSoDao.Instance.Create(entity))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm mới giá vé không thành công");
         }
     }
     return(View());
 }
Exemplo n.º 4
0
        public bool Update(GiaVeSo entity)
        {
            try
            {
                var model = GetSingle(entity.MaGia);

                model.Gia         = entity.Gia;
                model.NgayBatDau  = entity.NgayBatDau;
                model.NgayKetThuc = entity.NgayKetThuc;
                model.TrangThai   = entity.TrangThai;

                db.SaveChanges();
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }