Exemplo n.º 1
0
        private async void btnSave_Click(object sender, EventArgs e)
        {
            var subcategoryCategories = Convert.ToInt32(cbCategory.SelectedValue);

            var request = new SubcategoryUpsertRequest()
            {
                Name       = txtName.Text,
                CategoryID = subcategoryCategories
            };

            await subcategoryService.Insert <MSubcategory>(request);

            MessageBox.Show("Subcategory added successfully", "Success", MessageBoxButtons.OK);
            PanelHelper.SwapPanels(this.Parent, this, new CourseAdd(_user, _course));
        }
Exemplo n.º 2
0
        private async void btnSave_Click(object sender, EventArgs e)
        {
            var category = await categoryService.GetById <MCategory>(Convert.ToInt32(cbCategory.SelectedValue));

            var request = new SubcategoryUpsertRequest()
            {
                Name         = txtName.Text,
                CategoryID   = category.CategoryID,
                CategoryName = category.Name
            };

            await subcategoryService.Insert <MSubcategory>(request);

            MessageBox.Show("Subcategory added successfully", "Success", MessageBoxButtons.OK);
            PanelHelper.SwapPanels(this.Parent, this, new SubcategoryList());
        }