public bool Create(GiaVeSo entity) { try { db.GiaVeSo.Add(entity); db.SaveChanges(); } catch (Exception) { return(false); } return(true); }
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)); }
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()); }
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); }