public JsonResult GetListTypeOfCustomer() { List <Models.LoaiKhachHang> ListTypeOfCustomer = new List <Models.LoaiKhachHang>(); Database db = new Database(); DataTable dt = db.Query("select * from LoaiKhachHang; "); for (int i = 0; i < dt.Rows.Count; i++) { Models.LoaiKhachHang TypeOfCustomer = new Models.LoaiKhachHang(); TypeOfCustomer.MaLoaiKH = dt.Rows[i]["MaLoaiKH"].ToString(); TypeOfCustomer.LoaiKH = dt.Rows[i]["LoaiKH"].ToString(); ListTypeOfCustomer.Add(TypeOfCustomer); } return(Json(ListTypeOfCustomer)); }
public JsonResult TypeOfCustomerList() { Database db = new Database(); List <Models.LoaiKhachHang> listtypeofCus = new List <Models.LoaiKhachHang>(); DataTable dt = db.Query("select * from LoaiKhachHang"); for (int i = 0; i < dt.Rows.Count; i++) { Models.LoaiKhachHang typeofcus = new Models.LoaiKhachHang(); typeofcus.MaLoaiKH = dt.Rows[i]["MaLoaiKH"].ToString(); typeofcus.LoaiKH = dt.Rows[i]["LoaiKH"].ToString(); typeofcus.DiemChuan = dt.Rows[i]["DiemChuan"].ToString(); listtypeofCus.Add(typeofcus); } return(Json(listtypeofCus)); }
public void AddTypeOfCustomerList(Models.LoaiKhachHang a) { Database db = new Database(); db.Insert("insert into LoaiKhachHang values (N'" + a.LoaiKH + "'," + a.DiemChuan + ")"); }