public void EmpireMarketSubsegmentRequest() { ErrorMessage = ""; //string output = ""; ObjectParameter tranDt = new ObjectParameter("TranDT", typeof(DateTime)); ObjectParameter res = new ObjectParameter("Result", typeof(int)); try { _context.usp_QT_EmpireMarketSubsegment_Request(OperatorCode, Subsegment, Note, tranDt, res); //var collection = _context.usp_QT_EmpireMarketSubsegment_Request(OperatorCode, Subsegment, Note, tranDt, res); //foreach (var item in collection) output = item.ToString(); // output can be a returned value or an error message //if ((int)res.Value == 0) // Object parameters are not populated until after the result set is read //{ // OperatorName = output; // return; //} //ErrorMessage = output; } catch (Exception ex) { ErrorMessage = (ex.InnerException != null) ? "Request failed. " + ex.InnerException.Message : "Request failed. " + ex.Message; } }