public async Task <JsonResult> UpdateRiskSectionScore([FromBody] RiskSectionScoreView model) { if (string.IsNullOrEmpty(model.RiskSectionScoreID.ToString())) { return(Json("Fail")); } var dataResult = await _riskAssessmentRepository.UpdateRiskSectionScoreAsync(model); return(Json("success")); }
public Task <OperationResult> UpdateRiskSectionScoreAsync(RiskSectionScoreView data) { const string command = "Update RiskSectionScore set Maturity = @Maturity, Efficiency = @Efficiency, RiskLevel = @RiskLevel " + "Where RiskSectionScoreID = @RiskSectionScoreID"; int rowsUpdated = Task.Run(() => _sqlConnection.ExecuteAsync(command, new { data.Maturity, data.Efficiency, data.RiskLevel, data.RiskSectionScoreID })).Result; return(Task.FromResult(rowsUpdated.Equals(1) ? OperationResult.Success : OperationResult.Failed(new OperationResultError { Code = string.Empty, Description = $"The Section score with name {data.SectionName} could not be updated in the dbo.RiskSectionScore table." }))); }