public bool update(tinhthanh _tt) { tinhthanh tt = tinhthanhrespository.First(c => c.id == _tt.id); tt.matt = _tt.matt; tt.tentt = _tt.tentt; return(tinhthanhrespository.Update(tt)); }
private void themttbtn_Click(object sender, EventArgs e) { tinhthanh tt = new tinhthanh(); tt.matt = matttxt.Text; tt.tentt = tentttxt.Text; bool s = ttbus.tinhthanhrespository.Add(tt); helpers.successorerror(s); if (s) { helpers.ClearOnlyTextBoxes(tinhthanhpanel); loadtinhthanhdgv(); } }
private void suattbtn_Click(object sender, EventArgs e) { tinhthanh tt = new tinhthanh(); tt.id = currentid; tt.matt = matttxt.Text; tt.tentt = tentttxt.Text; bool s = ttbus.update(tt); helpers.successorerror(s); if (s) { exiteditingmode(); loadtinhthanhdgv(); } }
public bool sua(int id, string matt, string tentt) { try { tinhthanh t = db.tinhthanhs.First(o => o.id == id); t.matt = matt; t.tentt = tentt; db.Entry(t).State = EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { MessageBox.Show("Lỗi " + ex); return(false); } }
public bool them(string matt, string tentt) { try { tinhthanh t = new tinhthanh(); t.matt = matt; t.tentt = tentt; db.tinhthanhs.Add(t); db.SaveChanges(); return(true); } catch (Exception ex) { MessageBox.Show("Lỗi :" + ex); return(false); } }
public tinhthanhdto(tinhthanh o) { ID = o.id; matt = o.matt; tentt = o.tentt; }