private async void CommandInvokedHandler(IUICommand command) { if (command.Label == "Yes") { using (var db = new HotelDbContext()) { db.Sobe.Remove(Selektovana); db.SaveChanges(); var dialog = new MessageDialog("You have deleted room " + Selektovana.Naziv); await dialog.ShowAsync(); SobeListe.Remove(Selektovana); } } }
public async void clean(object p) { if (Selektovana != null) { using (var db = new HotelDbContext()) { var izmjenjena = db.Sobe.FirstOrDefault(v => v == Selektovana); izmjenjena.Ociscena = true; db.SaveChanges(); SobeListe.Remove(Selektovana); SobeListe.Add(izmjenjena); } } else { var dialog = new MessageDialog("You haven't selected room!"); dialog.Title = "Error"; await dialog.ShowAsync(); } }