protected async void BtnSave_Click(object sender, EventArgs e) { var newUnit = new ProductUnitViewModel { Name = txtName.Text, Description = txtDescription.Text }; HttpClient client = new HttpClient(); var x = await client.GetAsync("https://localhost:44313/api/Login/4"); var valid = manager.Validatation(new UnitValidator(unitsList, newUnit)); if (valid != string.Empty) { return; } manager.CreateAndSave(newUnit); }