public void OnDialogOpened(IDialogParameters parameters) { BookAccount = parameters.GetValue <BookAccountModel>("account"); if (BookAccount == null) { BookAccount = new BookAccountModel() { Konto = "", Opis = "" }; } }
public void Post([FromBody] BookAccountModel account) { if (_bookAccount.Exists(account)) { _bookAccount.Update(account); } else { _bookAccount.Insert(account); } }
public void Update(BookAccountModel account) { try { _sql.StartTransaction("AccountingConnStr"); _sql.SaveDataInTransaction("dbo.spBookAccounts_Update", account); } catch (System.Exception) { _sql.RollBackTransaction(); throw; } }
public async Task <bool> Insert(BookAccountModel account) { using (HttpResponseMessage response = await _apiService.ApiClient.PostAsJsonAsync("/api/BookAccounts/", account)) { if (response.IsSuccessStatusCode) { return(true); } else { throw new Exception(response.ReasonPhrase); } } }
public bool Exists(BookAccountModel account) { try { _sql.StartTransaction("AccountingConnStr"); var result = _sql.LoadDataInTransaction <BookAccountModel, dynamic>("dbo.spBookAccounts_IfExists", new { Konto = account.Konto }); return(result.Count > 0); } catch (System.Exception) { _sql.RollBackTransaction(); throw; } }