public string Add(ThresholdRequest tData) { try { string stProc = AddThresholdValue; var retVal = new SqlParameter("@Scope_output", 1); retVal.Direction = ParameterDirection.Output; var pList = new List <SqlParameter> { new SqlParameter("@TestTypeID", tData.testTypeID), new SqlParameter("@TestName", tData.testName ?? tData.testName), new SqlParameter("@ThresholdValue", tData.thresholdValue), new SqlParameter("@Isactive", tData.isActive ?? tData.isActive), new SqlParameter("@Comments", tData.comments ?? tData.comments), new SqlParameter("@Createdby", tData.createdBy), new SqlParameter("@Updatedby", tData.updatedBy), retVal }; UtilityDL.ExecuteNonQuery(stProc, pList); return("Threshold added successfully"); } catch (Exception e) { throw e; } }
public ActionResult <string> Add(ThresholdRequest tData) { try { var threshold = _thresholdService.Add(tData); return(string.IsNullOrEmpty(threshold) ? $"Unable to add threshold data" : threshold); } catch (Exception e) { return($"Unable to add threshold data - {e.Message}"); } }
public string Add(ThresholdRequest tData) { try { if (tData.isActive.ToLower() != "true") { tData.isActive = "false"; } if (tData.testTypeID <= 0) { return("Invalid test type id"); } var result = _thresholdData.Add(tData); return(string.IsNullOrEmpty(result) ? $"Unable to add threshold data" : result); } catch (Exception e) { return($"Unable to add threshold data - {e.Message}"); } }