Beispiel #1
0
        public async Task <Result <TransacBudgetData> > FindTBudgetById(int tBudgetId)
        {
            using (SqlConnection con = new SqlConnection(_connectionString))
            {
                TransacBudgetData tBudget = await con.QueryFirstOrDefaultAsync <TransacBudgetData>(
                    @"select 
                             tb.TBudgetId,
                             tb.Price,
                             tb.Date,
                             tb.BudgetId,
                             tb.RoomieId
                     from rm.tTransacBudget tb
                     where tb.TBudgetId = @TBudgetId;",
                    new { TBudgetId = tBudgetId });

                if (tBudget == null)
                {
                    return(Result.Failure <TransacBudgetData>(Status.NotFound, "Transaction not found"));
                }
                return(Result.Success(tBudget));
            }
        }
Beispiel #2
0
 public async Task<IActionResult> UpdateTransacBudget( [FromBody] TransacBudgetData model )
 {
     Result result = await _tBudgetGateway.UpdateTransacBudget( model.TBudgetId, model.Price, model.Date, model.BudgetId, model.RoomieId );
     return this.CreateResult( result );
 }