public HttpResponseMessage UpdateBudget(BudgetUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            string userId = _userService.GetCurrentUserId();

            _userService.UpdateBudget(model, userId);

            SuccessResponse response = new SuccessResponse();

            return Request.CreateResponse(HttpStatusCode.OK, response);
        }
예제 #2
0
        public void UpdateBudget(BudgetUpdateRequest model, string userId)
        {
            DataProvider.ExecuteNonQuery(GetConnection, "dbo.Users_UpdateBudget"
               , inputParamMapper: delegate (SqlParameterCollection paramCollection)
               {
                   paramCollection.AddWithValue("@EmploymentStatus", model.EmploymentStatus);
                   paramCollection.AddWithValue("@HomeStatus", model.HomeStatus);
                   paramCollection.AddWithValue("@CreditCardDebt", model.CreditCardDebt);
                   paramCollection.AddWithValue("@StudentLoanDebt", model.StudentLoanDebt);
                   paramCollection.AddWithValue("@Income", model.Income);
                   paramCollection.AddWithValue("@Expenses", model.Expenses);
                   paramCollection.AddWithValue("@Savings", model.Savings);
                   paramCollection.AddWithValue("@UserId", userId);

               }

               , returnParameters: delegate (SqlParameterCollection param)
               {

               }
               );
        }