public int CreateBankTrn(BankTrn banktrn) { int res = 0; try { using (var sqlconnection = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString)) { SqlCommand cmd = new SqlCommand("SaveBankTransactions", sqlconnection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TransactionType", banktrn.TransactionType); cmd.Parameters.AddWithValue("@Amount", banktrn.Amount); cmd.Parameters.AddWithValue("@DateOfTrn", banktrn.DateOfTrn); cmd.Parameters.AddWithValue("@TrnDoneBy", banktrn.TrnDoneBy); sqlconnection.Open(); res = cmd.ExecuteNonQuery(); sqlconnection.Close(); } } catch (Exception ex) { ex.Message.ToString(); } return(res); }
public IHttpActionResult CreateBankTrn(BankTrn banktrn) { var NewBankTrn = _repository.CreateBankTrn(banktrn); return(Ok(NewBankTrn)); }