async void OnFocusOutHandler(FocusEventArgs e) { if (previousName != Boss.Name) { Console.WriteLine("Focus handler updating boss"); if (Boss.Id == null) { Boss = await bossService.AddBoss(Instance, Boss); InstanceForm.AddBoss(Boss); ToastService.UpdateMessage(this, $"Successfully added boss {Boss.Name}", ToastLevel.Success); } else { bossService.UpdateBoss(Instance, Boss); InstanceForm.UpdateBosses(); ToastService.UpdateMessage(this, $"Successfully updated boss {Boss.Name}", ToastLevel.Success); } } else { Console.WriteLine("Focus handler doing nothing!"); } previousName = Boss.Name; }
public async void DeleteBoss() { bool confirmed = await JSRuntime.InvokeAsync <bool>("confirm", $"Are you sure you want to delete {Boss.Name}?"); if (confirmed) { bossService.DeleteBoss(Instance, Boss); InstanceForm.DeleteBoss(Boss); ToastService.UpdateMessage(this, $"Successfully deleted {Boss.Name}", ToastLevel.Success); } }