public static void Add(CTLopHP lop) { var db = new OnthiDB(); db.CTLopHPDbSet.Add(lop); db.SaveChanges(); }
public static void Remove(CTLopHP ten) { var db = new OnthiDB(); var ojbSV = db.CTLopHPDbSet.Where(e => e.mact == ten.mact).FirstOrDefault(); if (ojbSV != null) { db.CTLopHPDbSet.Remove(ojbSV); } db.SaveChanges(); }
public static void Update(LopHP sv) { var db = new OnthiDB(); var result = db.LopHPDbSet.Where(e => e.malhp == sv.malhp).FirstOrDefault(); if (result != null) { result.malhp = sv.malhp; result.tenlhp = sv.tenlhp; result.gv = sv.gv; result.dmsv = sv.dmsv; result.mamh = sv.mamh; } db.SaveChanges(); }