I have an ASP.net core project, using controllers and models, I have a ValidatePromoCodeApi class ,
[HttpGet]
[Route("/ValidatePromoCode")]
// [SwaggerOperation("ValidatePromoCodeGet")]
// [SwaggerResponse(200, type: typeof(PromoCodeResponse))]
public IActionResult ValidatePromoCodeGet([FromQuery]string promocode, [FromQuery]double? staylength, [FromQuery]double? orderAmount)
{
SqlConnection sqlConn = new SqlConnection("server=ROHIT-LAPTOP\\SQLEXPRESS;database=UseTest;uid=rohit;password=111222Rt;");
string sql = "spReadParam";
SqlCommand sqlCmd = new SqlCommand(sql, sqlConn);
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.AddWithValue("@Param", "Rohit");
SqlParameter outPutParam = new SqlParameter();
outPutParam.ParameterName = "@ParamOutput";
outPutParam.SqlDbType = System.Data.SqlDbType.VarChar;
outPutParam.Direction = System.Data.ParameterDirection.Output;
sqlCmd.Parameters.Add(outPutParam);
sqlConn.Open();
sqlCmd.CommandText = sql;
sqlCmd.ExecuteNonQuery();
sqlConn.Close();
string Parameter = outPutParam.Value.ToString();
return new ObjectResult(theResp);
}