private void butxoa_Click(object sender, EventArgs e) { if (txtma.Text == "" || txtten.Text == "") { MessageBox.Show("Chưa chọn thông tin"); return; } Tacgia tg = new Tacgia(); tg.matg = txtma.Text; tg.tentg = txtten.Text; tg.diachi = txtdc.Text; if (MessageBox.Show(string.Format("Xóa tác giả"), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.DeleteProfile(tg) > 0) { MessageBox.Show("Đã xóa"); tacgia_Load(sender, e); } else { MessageBox.Show("lỗi"); } } }
private void butluu_Click(object sender, EventArgs e) { if (txtma.Text == "" || txtten.Text == "") { MessageBox.Show("Chưa nhập đủ thông tin"); return; } Tacgia tg = new Tacgia(); tg.matg = txtma.Text; tg.tentg = txtten.Text; tg.diachi = txtdc.Text; if (MessageBox.Show(string.Format("thêm tác giả"), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.InsertProfile(tg) > 0) { MessageBox.Show("Đã lưu"); tacgia_Load(sender, e); } else { MessageBox.Show(" chưa lưu"); } } }
public bool Delete(Tacgia entity) { var model = _context.Tacgias.Find(entity.Id); _context.Tacgias.Remove(model); _context.SaveChanges(); return(true); }
public ActionResult DeleteConfirmed(string id) { Tacgia tacgia = db.Tacgias.Find(id); db.Tacgias.Remove(tacgia); db.SaveChanges(); return(RedirectToAction("Index")); }
public static int DeleteProfile(Tacgia tg) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ma", tg.matg), new SqlParameter("@ten", tg.tentg), }; return(DataProvider.ExecuteNonQuery("xoatacgia", para)); }
public static int InsertProfile(Tacgia tg) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ma", tg.matg), new SqlParameter("@ten", tg.tentg), new SqlParameter("@diachi", tg.diachi), }; return(DataProvider.ExecuteNonQuery("themtacgia", para)); }
public ActionResult ThemTacGia(string tenTG) { Tacgia tg = new Tacgia(); tg.Tentacgia = tenTG; db.Tacgias.Add(tg); db.SaveChanges(); return(RedirectToAction("ThemSach")); }
public ActionResult Edit([Bind(Include = "matacgia,tentacgia,diachi,dienthoai")] Tacgia tacgia) { if (ModelState.IsValid) { db.Entry(tacgia).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tacgia)); }
public ActionResult Create([Bind(Include = "matacgia,tentacgia,diachi,dienthoai")] Tacgia tacgia) { if (ModelState.IsValid) { db.Tacgias.Add(tacgia); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tacgia)); }
// GET: Tacgias/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tacgia tacgia = db.Tacgias.Find(id); if (tacgia == null) { return(HttpNotFound()); } return(View(tacgia)); }
public int Add(Tacgia item) { _context.Tacgias.Add(item); _context.SaveChanges(); return(item.Id); }
public static int DeleteProfile(Tacgia tg) { return(Dao.DeleteProfile(tg)); }
public static int UpdateProfile(Tacgia tg) { return(Dao.UpdateProfile(tg)); }
public static int InsertProfile(Tacgia tg) { return(Dao.InsertProfile(tg)); }
public bool Update(Tacgia item) { _context.Entry(item).State = EntityState.Modified; return(_context.SaveChanges() > 0); }
public int Add(Tacgia item) { return(_repository.Add(item)); }
public bool Delete(Tacgia entity) { return(_repository.Delete(entity)); }
public bool Update(Tacgia item) { return(_repository.Update(item)); }