Beispiel #1
0
 public IActionResult AddNewPayment(AddPaymentTypeDto newPaymentType)
 {
     if (_repo.AddNewPaymentType(newPaymentType))
     {
         return(Created($"paymentType/{newPaymentType.Type}", newPaymentType));
     }
     else
     {
         return(BadRequest());
     }
 }
Beispiel #2
0
 public bool AddNewPaymentType(AddPaymentTypeDto newPaymentType)
 {
     using (var db = new SqlConnection(_connectionString))
     {
         var sql = @"INSERT INTO [PaymentType]
                         ([UserId],
                          [AccountNumber],
                          [Type])
                     VALUES
                         (@userId,
                          @accountNumber,
                          @type)";
         return(db.Execute(sql, newPaymentType) == 1);
     }
 }