Untitled

 avatar
unknown
plain_text
a year ago
1.1 kB
4
Indexable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Firebase.Database.Query;
using GroceryPalAdmin.Includes;
using GroceryPalAdmin.Views;
using Firebase.Database;
using static GroceryPalAdmin.Includes.GlobalVariables;

namespace GroceryPalAdmin.Models
{
    class Category
    {
        public string CatID { get; set; }
        public string CatName { get; set; }
       



        
        public async Task<bool> AddCategory(string catID, string catName)
        {
            var category = new Category()
            {
                CatID = catID,
                CatName = catName
               
            };

            try
            {
                await client.Child("category").PostAsync(category);
                return true;
            }
            catch (Exception ex)
            {
                // Log or handle the error as needed
                Console.WriteLine($"Error adding product: {ex.Message}");
                return false;
            }
        }



    }
}
Editor is loading...
Leave a Comment