public async Task <JsonResult> UpdateRiskGuidelinesComment([FromBody] RiskGuidelinesScoreView model) { if (string.IsNullOrEmpty(model.RiskGuidelinesScoreID.ToString())) { return(Json("Fail")); } var dataResult = await _riskAssessmentRepository.UpdateRiskGuidelinesScoreAsync(model.RiskGuidelinesScoreID.ToString(), model.Comments); return(Json("success")); }
public Task <OperationResult> UpdateRiskGuidelinesScoreAsync(RiskGuidelinesScoreView data) { const string command = "Update RiskGuidelinesScore set MaturityEarned = @MaturityEarned, Impact = @Impact, Comments = @Comments " + "Where RiskGuidelinesScoreID = @RiskGuidelinesScoreID"; int rowsUpdated = Task.Run(() => _sqlConnection.ExecuteAsync(command, new { data.RiskGuidelinesScoreID, data.MaturityEarned, data.Impact, data.Comments })).Result; return(Task.FromResult(rowsUpdated.Equals(1) ? OperationResult.Success : OperationResult.Failed(new OperationResultError { Code = string.Empty, Description = $"The MaturityEarned score with ID {data.RiskGuidelinesScoreID} could not be updated in the dbo.RiskGuidelinesScore table." }))); }