コード例 #1
0
        public async Task <HttpResponseModel> Billing_TransMiscellaneous_Set(TransMiscellaneousForCreateUpdate model)
        {
            var result = await _repo.Billing_TransMiscellaneous_Set(model);

            var modelForReturn = new HttpResponseModel();

            switch (result)
            {
            case 1:
                modelForReturn.HttpStatusCode = _response.Created;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Created);
                modelForReturn.Remarks        = "successfully added.";
                break;

            case 2:
                modelForReturn.HttpStatusCode = _response.Updated;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.Updated);
                modelForReturn.Remarks        = "successfully updated.";
                break;

            default:
                modelForReturn.HttpStatusCode = _response.BadRequest;
                modelForReturn.ResponseModel  = _response.ShowHttpResponse(_response.BadRequest);
                modelForReturn.Remarks        = "error processing request.";
                break;
            }

            return(modelForReturn);
        }
コード例 #2
0
        public async Task <IActionResult> TransAddMiscellaneous([FromBody] TransMiscellaneousForCreateUpdate model)
        {
            var result = await _service.Billing_TransMiscellaneous_Set(model);

            if (result != null)
            {
                return(StatusCode(result.HttpStatusCode, new { response = result.ResponseModel, remaks = result.Remarks }));
            }

            return(BadRequest());
        }
コード例 #3
0
        public async Task <int?> Billing_TransMiscellaneous_Set(TransMiscellaneousForCreateUpdate model)
        {
            using (var con = GetDbConnection(_options.Value.DevHubDBConn))
            {
                var result = await con.QueryAsync <int?>("dbo.DevHub_Billing_TransMiscellaneous_Set",
                                                         new
                {
                    @iIntTranMisc_Id         = model.TranMisc_Id,
                    @iIntTimeTrackerId       = model.TimeTrackerId,
                    @iStrTranMiscDescription = model.TranMiscDescription,
                    @iDecTranMiscAmount      = model.TranMiscAmount,
                    @iBitIsPaid = model.IsPaid
                },
                                                         commandType : CommandType.StoredProcedure);

                return(result.FirstOrDefault());
            }
        }