public async Task PostModel(ModelAdd model) { using (HttpResponseMessage responseMessage = await _aPIHelper.ApiClient.PostAsJsonAsync("api/Models/nowe2", model)) { if (responseMessage.StatusCode == System.Net.HttpStatusCode.OK) { //ActivateItem(IoC.Get<Car2ViewModel>()); } else { throw new Exception(); } } }
public async Task AddModel() { ModelAdd model = new ModelAdd() { Name = this.Name2, Brand_ = this.Brand, FirstDateProduction = this.FirstDateProduction }; // try { await _modelEndPoint.PostModel(model); _addedViewModel.UpdateMessage("Komunikat", "Dodano rekord"); _windowManager.ShowWindow(_addedViewModel); } catch { _addedViewModel.UpdateMessage("Ostrzeżenie", "Nie dodano rekord"); _windowManager.ShowWindow(_addedViewModel); } }