public ActionResult ListCategories() { var target = new BusinessCategory(); var retorno = target.GetAllCategories(); return(Json(retorno, JsonRequestBehavior.AllowGet)); }
//Método para Refrescar la información de la tabla private void RefreshDataGridView() { List <CategoryForm> categories = BusinessCategory.GetAllCategories().ToList(); this.dtgridCatgory.DataSource = categories; DisabledFields(); }
private void Subcategories_Load(object sender, EventArgs e) { RefreshDataGridView(); IEnumerable <DataAccess.Entities.Category> categories = BusinessCategory.GetAllCategories().ToList(); comboInsert.DataSource = categories; comboInsert.DisplayMember = "CategoryName"; comboInsert.ValueMember = "CategoryId"; }
// Método para editar una subcategoria private void SubcategoryClick(object sender, DataGridViewCellEventArgs e) { EnabledFields(); IEnumerable <DataAccess.Entities.Category> categories = BusinessCategory.GetAllCategories().ToList(); comboSubcategory.DataSource = categories; comboSubcategory.DisplayMember = "CategoryName"; comboSubcategory.ValueMember = "CategoryId"; var rows = this.dtgridSubcatgory.CurrentRow; if (rows != null) { this.txtSubcategoryName.Text = rows.Cells["SubcategoryName"].Value.ToString(); this.txtSubcategoryDescripcion.Text = rows.Cells["SubcategoryDescription"].Value.ToString(); this.lbId.Text = rows.Cells["SubcategoryId"].Value.ToString(); this.comboSubcategory.Text = rows.Cells["Category"].Value.ToString(); } else { MessageBox.Show("Selecciona una fila"); } }