public static khachhang login(string email, string pwd) { using (db = new Model()) { khachhang kh = db.khachhangs.Where(x => x.Email == email & x.Password == pwd).SingleOrDefault(); if (kh != null) { return(kh); } return(null); } }
//Thêm public void insertKhachHang(KhachHangDTO khDTO) { khachhang kh = new khachhang(); kh.makhachhang = khDTO.Makhachhang; kh.tenkhachhang = khDTO.Tenkhachhang; kh.gioitinh = (Boolean)khDTO.Gioitinh; kh.cmnd_passport = khDTO.CMND_PASSPORT; kh.diachi = khDTO.Diachi; kh.coquan = khDTO.Coquan; kh.sodienthoai = khDTO.Sodienthoai; kh.email = khDTO.Email; htDataContext.khachhangs.InsertOnSubmit(kh); htDataContext.SubmitChanges(); }