public string InsertHD(HDDienNuoc entity) { try { db.HDDienNuocs.Add(entity); db.SaveChanges(); return(entity.MaHDDN); } catch { return(null); } }
public bool UpdateHD(HDDienNuoc entity) { try { var hd = db.HDDienNuocs.SingleOrDefault(x => x.MaHDDN == entity.MaHDDN); hd.MaSV = entity.MaSV; hd.MaDien = entity.MaDien; hd.MaNuoc = entity.MaNuoc; hd.SoDien = entity.SoDien; hd.SoNuoc = entity.SoNuoc; hd.NgayLap = entity.NgayLap; hd.NgayTra = entity.NgayTra; //user.MaSV = entity.MaSV; db.SaveChanges(); } catch { return(false); } return(true); }