public bool AddOrder(Order o) { FirebaseResponse response = firebaseClient.Get($"Orders/{o.Id}"); if (response.Body == "null") { FirebaseResponse response1 = firebaseClient.Get($"Customers/{o.Customer_Id}"); if (response1.Body == "null") { Console.WriteLine("Customer does not exist"); return(false); } else { SetResponse response2 = firebaseClient.Set($"Orders/{o.Id}", o); DataOrd result = response1.ResultAs <DataOrd>(); Console.WriteLine($"Order inserted {o.Id}"); return(true); } } else { Console.WriteLine("Order ID already exist in data"); return(false); } }
public bool UpdateOrder(Order o) { Customer c = GetCustomerById(o.Customer_Id); if (c.Id != 0) { FirebaseResponse respone = firebaseClient.Update($"Order/{o.Id}", o); DataOrd or = respone.ResultAs <DataOrd>(); return(true); } else { Console.WriteLine("Customer does not exist"); return(false); } }