public BindableCollection <Category> Get_AllCategory() { ListCategory.Clear(); sql = "SELECT * FROM CATEGORY"; DataTable dt = Connection.GetALL_Data(sql); foreach (DataRow row in dt.Rows) { Category category = new Category(); category.IdCategory = row["IDCATEGORY"].ToString(); category.CategoryName = row["CATEGORYNAME"].ToString(); ListCategory.Add(category); } return(ListCategory); }
private async void GetListCategory() { try { var listData = conn.GetListCategory(); ListCategory.Clear(); foreach (var item in listData) { ListCategory.Add(item); } ; } catch { await new MessageDialog("Get Category Faild ! Something wrong !").ShowAsync(); } }