Untitled

mail@pastecode.io avatar
unknown
plain_text
15 days ago
1.1 kB
0
Indexable
Never
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;
            }
        }



    }
}
Leave a Comment