public AppuntoDetailsPage(Appunto selectedAppunto)
 {
     InitializeComponent();
     Title      = "Visualizza Appunto";
     vm         = Resources["vm"] as AppuntoDetailsVM;
     vm.Appunto = selectedAppunto;
 }
Exemplo n.º 2
0
        public void OnComplete(Android.Gms.Tasks.Task task)  //qui otteniani il risultato della query
        {
            if (task.IsSuccessful)
            {
                var documents = (QuerySnapshot)task.Result;
                appuntiList.Clear();
                foreach (var doc in documents.Documents)
                {
                    string description;
                    if (doc.Get("description") == null)
                    {
                        description = "";
                    }
                    else
                    {
                        description = doc.Get("description").ToString();
                    }
                    Appunto appunto = new Appunto
                    {
                        Name        = doc.Get("name").ToString(),
                        Description = description,
                        IdCorso     = doc.Get("idCorso").ToString(),
                        Id          = doc.Id
                    };

                    appuntiList.Add(appunto);
                }
            }
            else
            {
                appuntiList.Clear();
            }
            hasReadAppunti = true;
        }
Exemplo n.º 3
0
 public async Task <bool> UpdateAppunto(Appunto appunto)
 {
     try
     {
         var collection = Firebase.Firestore.FirebaseFirestore.Instance.Collection("users").Document(Firebase.Auth.FirebaseAuth.Instance.CurrentUser.Uid).Collection("Corsi").Document(appunto.IdCorso).Collection("Appunti");
         collection.Document(appunto.Id).Update("name", appunto.Name, "description", appunto.Description, "idCorso", appunto.IdCorso);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 public async Task <bool> DeleteAppunto(Appunto appunto)
 {
     try
     {
         var collection = Firebase.Firestore.FirebaseFirestore.Instance.Collection("users").Document(Firebase.Auth.FirebaseAuth.Instance.CurrentUser.Uid).Collection("Corsi").Document(appunto.IdCorso).Collection("Appunti");
         collection.Document(appunto.Id).Delete();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemplo n.º 5
0
        public bool InsertAppunto(Appunto appunto)
        {
            try
            {
                var collection      = Firebase.Firestore.FirebaseFirestore.Instance.Collection("users").Document(Firebase.Auth.FirebaseAuth.Instance.CurrentUser.Uid).Collection("Corsi").Document(appunto.IdCorso).Collection("Appunti");
                var appuntoDocument = new Dictionary <string, Java.Lang.Object>
                {
                    { "name", appunto.Name },
                    { "description", appunto.Description },
                    { "idCorso", appunto.IdCorso }
                };
                collection.Add(appuntoDocument);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 6
0
 public static Task <bool> UpdateAppunto(Appunto appunto)
 {
     return(firestore.UpdateAppunto(appunto));
 }
Exemplo n.º 7
0
 public static bool InsertAppunto(Appunto appunto)
 {
     return(firestore.InsertAppunto(appunto));
 }
Exemplo n.º 8
0
 public static Task <bool> DeleteAppunto(Appunto appunto)
 {
     return(firestore.DeleteAppunto(appunto));
 }