public void Xoahoatchatgoc(string tenhoatchatgoc) { hoatchatgoc xoahoatchatgoc = (from tk in data.hoatchatgocs where tk.ten == tenhoatchatgoc select tk).Single(); data.hoatchatgocs.DeleteOnSubmit(xoahoatchatgoc); data.SubmitChanges(); }
public void Capnhathoatchatgoc(string tenhoatchatgoccu, string tenhoatchatgocmoi) { hoatchatgoc xoahoatchatgoc = (from tk in data.hoatchatgocs where tk.ten == tenhoatchatgoccu select tk).Single(); xoahoatchatgoc.ten = tenhoatchatgocmoi; data.SubmitChanges(); }
public void Themhoatchatgoc(string tenhoatchatgoc) { int dem = (from tk in data.hoatchatgocs select tk).ToList().Last().idhcgoc; hoatchatgoc themhoatchatgoc = new hoatchatgoc(); if (dem == 0) { themhoatchatgoc.idhcgoc = 1; } else { themhoatchatgoc.idhcgoc = short.Parse((dem + 1).ToString()); } themhoatchatgoc.ten = tenhoatchatgoc; data.hoatchatgocs.InsertOnSubmit(themhoatchatgoc); data.SubmitChanges(); }