public void Xoatenbenhpham(string tentenbenhpham) { tenbenhpham xoatenbenhpham = (from tk in data.tenbenhphams where tk.tenbp == tentenbenhpham select tk).Single(); data.tenbenhphams.DeleteOnSubmit(xoatenbenhpham); data.SubmitChanges(); }
public void Capnhattenbenhpham(string tentenbenhphamcu, string tentenbenhphammoi) { tenbenhpham xoatenbenhpham = (from tk in data.tenbenhphams where tk.tenbp == tentenbenhphamcu select tk).Single(); xoatenbenhpham.tenbp = tentenbenhphammoi; data.SubmitChanges(); }
public void Themtenbenhpham(string tentenbenhpham) { int dem = (from tk in data.tenbenhphams select tk).ToList().Last().idtenbenhpham; tenbenhpham themtenbenhpham = new tenbenhpham(); if (dem == 0) { themtenbenhpham.idtenbenhpham = 1; } else { themtenbenhpham.idtenbenhpham = short.Parse((dem + 1).ToString()); } themtenbenhpham.tenbp = tentenbenhpham; data.tenbenhphams.InsertOnSubmit(themtenbenhpham); data.SubmitChanges(); }