public async Task <APIResult> SaveImproveDistribution(string tPId, string itemId, string departmentId, string improvementCaption, string lostDescription, string inUserId, bool allocateYN = false) { ImprovementParamDto improvementParamDto = new ImprovementParamDto { tPId = Convert.ToInt32(tPId), itemId = Convert.ToInt32(itemId), departmentId = Convert.ToInt32(departmentId), improvementCaption = improvementCaption, lostDescription = lostDescription, inUserId = Convert.ToInt32(inUserId), allocateYN = allocateYN?"true":"false" }; APIResult info = await _commonHelper.HttpPOST <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.InsertAllocateImprovementItem"), improvementParamDto); return(info); }
public async Task <APIResult> SaveAllocateImprovementItem(ImprovementParamDto paramDto) { string spName = @"up_RMMT_IMP_AllocateImprovementItem_C"; DynamicParameters dp = new DynamicParameters(); dp.Add("@TPId", paramDto.tPId); dp.Add("@ItemId", paramDto.itemId); dp.Add("@DepartmentId", paramDto.departmentId); dp.Add("@AllocateYN", paramDto.allocateYN, DbType.Boolean); //dp.Add("@PlanApprovalId", paramDto.planApprovalId); //dp.Add("@ProcessId", paramDto.processId); dp.Add("@ImprovementCaption", paramDto.improvementCaption); dp.Add("@LostDescription", paramDto.lostDescription); dp.Add("@InUserId", paramDto.inUserId); using (var conn = new SqlConnection(DapperContext.Current.SqlConnection)) { conn.Open(); using (var tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted)) { try { IEnumerable <string> improvementMngResult = await conn.QueryAsync <string>(spName, dp, tran, null, CommandType.StoredProcedure); APIResult result = new APIResult { Body = CommonHelper.EncodeDto <string>(improvementMngResult), ResultCode = ResultType.Success, Msg = "" }; tran.Commit(); return(result); } catch (Exception ex) { tran.Rollback(); return(new APIResult { Body = "", ResultCode = ResultType.Failure, Msg = ex.Message }); } finally { tran.Dispose(); } } } }
public async Task <IActionResult> InsertAllocateImprovementItem([FromBody] ImprovementParamDto paramDto) { var saveResult = await _improvementService.SaveAllocateImprovementItem(paramDto); return(Ok(saveResult)); }